RedDotController.cs 888 B

123456789101112131415161718192021222324252627
  1. using FairyGUI;
  2. namespace GFGGame
  3. {
  4. public class RedDotController : SingletonBase<RedDotController>
  5. {
  6. public void SetComRedDot(GComponent parentCom, bool isRed)
  7. {
  8. GComponent comRedDot;
  9. if (parentCom.GetChild("comResDot") == null)
  10. {
  11. comRedDot = UIPackage.CreateObject("CommonGame", "ComRedDot").asCom;
  12. parentCom.AddChild(comRedDot);
  13. comRedDot.name = "comResDot";
  14. comRedDot.SetPosition(parentCom.width - comRedDot.width, 0, 0);
  15. comRedDot.AddRelation(comRedDot, RelationType.TopExt_Top);
  16. comRedDot.AddRelation(comRedDot, RelationType.RightExt_Right);
  17. }
  18. else
  19. {
  20. comRedDot = parentCom.GetChild("comResDot").asCom;
  21. }
  22. comRedDot.visible = isRed;
  23. }
  24. }
  25. }