123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- using CommonAI.Zone;
- using ET.Client;
- using ET.EventType;
- namespace ET
- {
- [Event(SceneType.None)]
- public class BattleFuncHandler : BEvent<BattleFunc>
- {
- public override void OnEvent(BattleFunc a)
- {
- Log.Debug($"Battle Func:{a.FuncIndex}");
- asyncHandler(a.FuncIndex).Coroutine();
- }
- private async ETTask asyncHandler(BattleFunc.Index index)
- {
- var session = PlayerComponent.Instance.ClientScene().GetComponent<SessionComponent>().Session;
- switch (index)
- {
- case BattleFunc.Index.Func2:
- var ret = await session.Call(new C2G_AddUnitsToMap()
- {
- UnitId = 102,
- Force = 1,
- X = 2,
- Y = 30
- });
- if (ret.Error != 0)
- {
- Log.Error(ret.Message);
- }
- break;
- default:
- break;
- }
- }
- }
-
- public partial class BattleMgr
- {
- private bool autoFight;
- public bool AutoFight
- {
- get
- {
- return autoFight;
- }
- set
- {
- if(value == autoFight) return;
- else
- {
- autoFight = value;
- }
- }
- }
- public CommonAI.Zone.Action SetAutoFight(bool flag)
- {
- return new UnitGuardAction(UnitMgr.Instance.ActorId, flag, CommonAI.XmdsConstConfig.AUTO_GUARD_MODE_POINT);
- }
- }
- }
|