| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 | 
							
- using System.Collections.Generic;
 
- using FairyGUI;
 
- namespace GFGGame
 
- {
 
-     public class RedDotController : SingletonBase<RedDotController>
 
-     {
 
-         private List<GComponent> comRedDotPool = new List<GComponent>();
 
-         public void Clear()
 
-         {
 
-             for (int i = 0; i < comRedDotPool.Count; i++)
 
-             {
 
-                 comRedDotPool[i].Dispose();
 
-             }
 
-             comRedDotPool.Clear();
 
-         }
 
-         public void SetComRedDot(GComponent parentCom, bool isRed, string res = "", int left = 0, int top = 0, bool dispatchEvent = true)
 
-         {
 
-             GComponent comRedDot;
 
-             if (isRed)
 
-             {
 
-                 if (parentCom.GetChild("comResDot") != null)
 
-                 {
 
-                     comRedDot = parentCom.GetChild("comResDot").asCom;
 
-                     comRedDot.visible = true;
 
-                     comRedDot.SetPosition(parentCom.width - comRedDot.width + left, top, 0);
 
-                     return;
 
-                 }
 
-                 if (comRedDotPool.Count > 0)
 
-                 {
 
-                     comRedDot = comRedDotPool[0];
 
-                     comRedDotPool.RemoveAt(0);
 
-                 }
 
-                 else
 
-                 {
 
-                     comRedDot = UIPackage.CreateObject("CommonGame", "ComRedDot").asCom;
 
-                 }
 
-                 parentCom.AddChild(comRedDot);
 
-                 comRedDot.name = "comResDot";
 
-                 comRedDot.SetPosition(parentCom.width - comRedDot.width + left, top, 0);
 
-                 // comRedDot.AddRelation(comRedDot, RelationType.TopExt_Top);
 
-                 // comRedDot.AddRelation(comRedDot, RelationType.RightExt_Right);
 
-                 string path = ResPathUtil.GetCommonGameResPath(res == "" ? "zx_hogndian" : res);
 
-                 GLoader loaIcon = comRedDot.GetChild("loaIcon").asLoader;
 
-                 loaIcon.url = path;
 
-                 if (dispatchEvent)
 
-                 {
 
-                     EventAgent.DispatchEvent(ConstMessage.RED_CHANGE);
 
-                 }
 
-             }
 
-             else
 
-             {
 
-                 if (parentCom.GetChild("comResDot") != null)
 
-                 {
 
-                     comRedDot = parentCom.GetChild("comResDot").asCom;
 
-                     comRedDotPool.Add(comRedDot);
 
-                     parentCom.RemoveChild(comRedDot);
 
-                     if (dispatchEvent)
 
-                     {
 
-                         EventAgent.DispatchEvent(ConstMessage.RED_CHANGE);
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-     }
 
- }
 
 
  |