using UnityEngine;
|
using System.Collections.Generic;
|
using vnxbqy.UI;
|
|
public class GA_ILClientPlayer : GActorPlayerBase, IOtherSelectable
|
{
|
private PlayerInfo info;
|
private static bool doAILogic = false;
|
|
public void Init(uint serverInstID, uint clientInstID, PlayerInfo playerInfo, E_ActorGroup group)
|
{
|
ArenaManager.OnILInit?.Invoke(serverInstID, clientInstID, playerInfo, group);
|
}
|
|
public static void Result(bool winOrLose)
|
{
|
ArenaManager.OnILPlayerResult?.Invoke(winOrLose);
|
}
|
|
protected override void OnInit(GameNetPackBasic package)
|
{
|
base.OnInit(package);
|
ArenaManager.OnILPlayerInit?.Invoke(package);
|
RequestName();
|
IdleImmediate();
|
}
|
public static void Reset()
|
{
|
ArenaManager.OnILPlayerReset?.Invoke();
|
}
|
public override void Destroy()
|
{
|
ArenaManager.OnILPlayerDestroy?.Invoke();
|
}
|
|
protected sealed override void OnUpdate()
|
{
|
if (ActorInfo.serverDie )
|
{
|
return;
|
}
|
|
base.OnUpdate();
|
|
ArenaManager.OnILPlayerUpdateAI?.Invoke();
|
|
if (ActorInfo.RealHp <= 0)
|
{
|
ActorInfo.serverDie = true;
|
Result(true);
|
}
|
|
|
}
|
|
protected sealed override void OnUnit()
|
{
|
base.OnUnit();
|
ArenaManager.OnILPlayerUnit?.Invoke();
|
}
|
|
public sealed override void OnHorse(byte upOrDown)
|
{
|
ArenaManager.OnILPlayerHorse?.Invoke(upOrDown);
|
}
|
|
public sealed override void RefreshLifeBar(ulong value)
|
{
|
ArenaManager.OnILPlayerRefreshLifeBar?.Invoke(value);
|
}
|
|
public sealed override void RequestName()
|
{
|
ReleaseName();
|
ArenaManager.OnILPlayerRequestName?.Invoke();
|
}
|
|
protected sealed override void OnPutonClothes(uint clothesItemID, GameObject clothed)
|
{
|
ArenaManager.OnILPlayerPutonClothes?.Invoke(clothesItemID, clothed);
|
}
|
|
protected sealed override void OnPutonSecondary(uint secondaryItemID, GameObject secondary)
|
{
|
ArenaManager.OnILPlayerPutonSecondary?.Invoke(secondaryItemID, secondary);
|
}
|
|
protected sealed override void OnPutonWeapon(uint weaponItemID, GameObject weapon)
|
{
|
ArenaManager.OnILPlayerPutonWeapon?.Invoke(weaponItemID, weapon);
|
}
|
|
protected sealed override void OnPutonWing(uint wingItemID, GameObject wing)
|
{
|
ArenaManager.OnILPlayerPutonWing?.Invoke(wingItemID, wing);
|
}
|
|
protected sealed override void OnSwitchHorse(uint horseID, GameObject horse)
|
{
|
ArenaManager.OnILPlayerSwitchHorse?.Invoke(horseID, horse);
|
}
|
|
public sealed override bool CanAtked()
|
{
|
return !ActorInfo.serverDie;
|
}
|
|
public bool CanBeSelected()
|
{
|
if (ActorInfo.serverDie)
|
{
|
return false;
|
}
|
|
return true;
|
}
|
|
public void OnClick()
|
{
|
if (ActorInfo.serverDie)
|
{
|
return;
|
}
|
ArenaManager.OnILPlayerClick?.Invoke();
|
}
|
|
public void OnSelect()
|
{
|
if (CanAtked())
|
{
|
SelectionManager.Request(SelectionManager.E_Type.Red, this);
|
}
|
else
|
{
|
SelectionManager.Request(SelectionManager.E_Type.Green, this);
|
}
|
|
if (GA_Player.s_OnSelected != null)
|
{
|
GA_Player.s_OnSelected(ServerInstID, true);
|
}
|
|
ArenaManager.OnILPlayerSelect?.Invoke();
|
}
|
|
public void OnUnSelect()
|
{
|
SelectionManager.Release(SelectionManager.E_Type.Green);
|
SelectionManager.Release(SelectionManager.E_Type.Red);
|
|
if (GA_Player.s_OnSelected != null)
|
{
|
GA_Player.s_OnSelected(ServerInstID, false);
|
}
|
ArenaManager.OnILPlayerUnSelect?.Invoke();
|
}
|
|
public sealed override void SyncSuitEffect(bool onOrOff = true)
|
{
|
ArenaManager.OnILPlayerSyncSuitEffect?.Invoke(onOrOff);
|
}
|
|
}
|