浏览代码

飘字改成显示三条

huangxiaoyue 1 年之前
父节点
当前提交
b1aebca52a
共有 1 个文件被更改,包括 9 次插入2 次删除
  1. 9 2
      GameClient/Assets/Game/HotUpdate/Controller/PromptController.cs

+ 9 - 2
GameClient/Assets/Game/HotUpdate/Controller/PromptController.cs

@@ -8,8 +8,8 @@ namespace GFGGame
 {
     public class PromptController : SingletonBase<PromptController>
     {
-
         private List<GComponent> _uis = new List<GComponent>();
+        private int showCount = 3;  //ÏÔʾ¶àÉÙÌõ
 
         public PromptController()
         {
@@ -69,7 +69,14 @@ namespace GFGGame
                 GComponent preui = _uis[_uis.Count - 1];
                 ui.x = preui.x;
                 ui.y = preui.y + 100;
+                if (_uis.Count >= showCount) {
+                    GComponent uiFirst = _uis[0];
+                    _uis.Remove(uiFirst);
+                    uiFirst.RemoveFromParent();
+                    uiFirst.Dispose();
+                }
             }
+
             ui.data = ET.TimeHelper.ClientNow() + 3000;
             _uis.Add(ui);
         }
@@ -78,7 +85,7 @@ namespace GFGGame
         {
             foreach (GComponent ui in _uis)
             {
-                ui.y -= 50;
+                ui.y -= 100;
             }
         }
     }