124 lines
4.1 KiB
C#
Executable File
124 lines
4.1 KiB
C#
Executable File
using System;
|
|
using Cal.DataTable;
|
|
using ET.EventType;
|
|
|
|
namespace ET
|
|
{
|
|
public partial class GlobalMethod
|
|
{
|
|
[DataTableMethod]
|
|
public static async ETTask<string> ActiveStarSoulCopy(object arg)
|
|
{
|
|
try
|
|
{
|
|
ActiveArgs args = arg.As<ActiveArgs>();
|
|
var unit = args.unit;
|
|
if (!unit.IsTeamLeader)
|
|
return "你不是队长";
|
|
if (unit.teamState != TeamState.None)
|
|
return "战斗中";
|
|
string[] param = args.param;
|
|
byte type = byte.Parse(param[0]);
|
|
byte difficulty = byte.Parse(param[1]);
|
|
int sceneId = type switch
|
|
{
|
|
1 => Sys_SceneId.Scene_StarSoulCopyA,
|
|
2 => Sys_SceneId.Scene_StarSoulCopyB,
|
|
3 => Sys_SceneId.Scene_StarSoulCopyC,
|
|
4 => Sys_SceneId.Scene_StarSoulCopyD,
|
|
5 => Sys_SceneId.Scene_StarSoulCopyE,
|
|
_ => throw new ArgumentOutOfRangeException()
|
|
};
|
|
var config = unit.GetOrAddComponent<StarSoulCopyConfigComponent>();
|
|
config.type = type;
|
|
config.difficulty = difficulty;
|
|
Game.EventSystem.Publish(new ChangeMap() { unit = unit, mapId = sceneId * 100 + 1 });
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
Log.Error(e);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
[DataTableMethod]
|
|
public static async ETTask<string> ActiveWorldBossCopy(object arg)
|
|
{
|
|
try
|
|
{
|
|
ActiveArgs args = arg.As<ActiveArgs>();
|
|
var unit = args.unit;
|
|
if (!unit.IsTeamLeader)
|
|
return "你不是队长";
|
|
if (unit.teamState != TeamState.None)
|
|
return "战斗中";
|
|
Game.EventSystem.Publish(new ChangeMap() { unit = unit, mapId = Sys_SceneId.Scene_WorldBoss * 100 + 1 });
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
Log.Error(e);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
[DataTableMethod]
|
|
public static async ETTask<string> ActiveIdleBattle(object arg)
|
|
{
|
|
try
|
|
{
|
|
Log.Info("ActiveIdleBattle");
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
Log.Error(e);
|
|
return "系统错误";
|
|
}
|
|
return null;
|
|
}
|
|
|
|
[DataTableMethod]
|
|
public static async ETTask<string> ActiveJourneyOfDeathCopy(object arg)
|
|
{
|
|
try
|
|
{
|
|
ActiveArgs args = arg.As<ActiveArgs>();
|
|
var unit = args.unit;
|
|
if (!unit.IsTeamLeader)
|
|
return "你不是队长";
|
|
if (unit.teamState != TeamState.None)
|
|
return "战斗中";
|
|
string[] param = args.param;
|
|
int level = int.Parse(param[0]);
|
|
Team team = TeamComponent.Instance.Get(unit.Id);
|
|
var canEnter=team.IsAllLevel(level);
|
|
if (!canEnter)
|
|
{
|
|
return "队伍中等级不符,无法进入";
|
|
}
|
|
byte difficulty = level switch
|
|
{
|
|
6000=>1,
|
|
6500=>2,
|
|
7000=>3,
|
|
8000=>4,
|
|
9000=>5,
|
|
10000=>6,
|
|
11000=>7,
|
|
12000=>8,
|
|
_ => throw new ArgumentOutOfRangeException()
|
|
};
|
|
var config = unit.GetOrAddComponent<JourneyOfDeathCopyConfigComponent>();
|
|
config.difficulty = difficulty;
|
|
|
|
int sceneId = Sys_SceneId.Scene_Death;
|
|
Game.EventSystem.Publish(new ChangeMap() { unit = unit, mapId = sceneId * 100 + 1 });
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
Log.Error(e);
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
} |