BattleScene.ZoneFlag.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using UnityEngine;
  2. using System.Collections;
  3. using CommonLang;
  4. using System.Collections.Generic;
  5. using CommonAI.Zone.ZoneEditor;
  6. using CommonAIClient.Unity.Utils;
  7. using CommonAI.ZoneClient;
  8. namespace CommonAIClient.Unity.Battle
  9. {
  10. public partial class BattleScene
  11. {
  12. HashMap<string, BattleFlag> mFlags = new HashMap<string, BattleFlag>();
  13. public T GetFlag<T>(string name) where T : BattleFlag
  14. {
  15. return mFlags.Get(name) as T;
  16. }
  17. protected void InitDecoration()
  18. {
  19. foreach (var zf in mBattle.Layer.Flags)
  20. {
  21. if (zf is ZoneEditorDecoration)
  22. {
  23. BattleDecoration dc = new BattleDecoration(this, zf as ZoneEditorDecoration);
  24. mFlags.Add(dc.Name, dc);
  25. dc.OnChanged();
  26. }
  27. }
  28. }
  29. private void Layer_DecorationChanged(ZoneLayer layer, ZoneEditorDecoration ed)
  30. {
  31. var dc = GetFlag<BattleDecoration>(ed.Name);
  32. if (dc != null)
  33. {
  34. dc.OnChanged();
  35. }
  36. }
  37. }
  38. }