You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.9 KiB
57 lines
1.9 KiB
using UnityEngine; |
|
|
|
namespace ET |
|
{ |
|
public class ResourceMonsterGroupViewComponentAwakeSystem: AwakeSystem<ResourceMonsterGroupViewComponent, long> |
|
{ |
|
public override void Awake(ResourceMonsterGroupViewComponent self, long monsterGroupId) |
|
{ |
|
self.Awake(monsterGroupId); |
|
} |
|
} |
|
|
|
public class ResourceMonsterGroupViewComponentDestroySystem: DestroySystem<ResourceMonsterGroupViewComponent> |
|
{ |
|
public override void Destroy(ResourceMonsterGroupViewComponent self) |
|
{ |
|
self.Destroy(); |
|
} |
|
} |
|
|
|
[FriendClass(typeof(ResourceViewComponent))] |
|
[FriendClass(typeof(ResourceMonsterGroupViewComponent))] |
|
public static class ResourceMonsterGroupViewComponentSystem |
|
{ |
|
public static void Awake(this ResourceMonsterGroupViewComponent self, long monsterGroupId) |
|
{ |
|
if (monsterGroupId <= 0) |
|
{ |
|
Log.Error("MonsterGroupId is invalid"); |
|
return; |
|
} |
|
|
|
Unit unit = UnitHelper.GetMyUnitFromZoneScene(self.ZoneScene()); |
|
var monsterGroupComp = unit.GetComponent<MonsterGroupComponent>(); |
|
var monsterGroup = monsterGroupComp.GetChild<MonsterGroup>(monsterGroupId); |
|
|
|
if (monsterGroup == null) |
|
{ |
|
return; |
|
} |
|
|
|
var monsterGroupConfig = monsterGroup.Config; |
|
|
|
var resourceView = self.Parent.GetComponent<ResourceViewComponent>(); |
|
GameObject monsterGO = self.InstantiateSync("MonsterIcon", resourceView.ResourceRoot.transform); |
|
self.Icon = monsterGO.GetComponent<SpriteRenderer>(); |
|
} |
|
|
|
public static void Destroy(this ResourceMonsterGroupViewComponent self) |
|
{ |
|
if (self.Icon != null) |
|
{ |
|
GameObject.Destroy(self.Icon.gameObject); |
|
} |
|
} |
|
} |
|
}
|
|
|