Esempio n. 1
0
 private void OnClickScreen()
 {
     if (this.m_currentBuildTop != null)
     {
         this.m_currentBuildTop.OnClick(null);
     }
     this.m_currentBuildTop = null;
 }
Esempio n. 2
0
        private void OnAddBuidUI(BuidAchorData archorData, GameObject obj, bool isGuid)
        {
            foreach (var kv in m_topUI)
            {
                for (int i = 0; i < kv.Value.Count; i++)
                {
                    if (kv.Value[i].isExist(archorData.m_buidID))
                    {
                        return;
                    }
                }
            }

            BuildTopIconComponent buildIcon = this.m_grid.AddChild <BuildTopIconComponent>();

            if (isGuid)
            {
                buildIcon.gameObject.name = obj.name;
                buildIcon.SetData(null, true);
            }
            else
            {
                buildIcon.SetData(archorData, isGuid);
            }
            Transform uiObj    = buildIcon.gameObject.transform;
            Vector3   localPos = EngineCore.Utility.CameraUtility.WorldPointInCanvasRectTransform(obj.transform.position, uiObj.gameObject);//this.m_grid.gameObject.transform.InverseTransformPoint(obj.transform.position);

            uiObj.transform.position = localPos;
            Transform tran = obj.transform;

            if (m_topUI.ContainsKey(tran))
            {
                m_topUI[tran].Add(buildIcon);
            }
            else
            {
                m_topUI.Add(tran, new List <BuildTopIconComponent>()
                {
                    buildIcon
                });
            }
            buildIcon.Visible = true;
        }
Esempio n. 3
0
 private void OnBuildTopActive(BuildTopIconComponent currentBuildTop, bool visible)
 {
     if (visible)
     {
         this.m_currentBuildTop = currentBuildTop;
         this.m_currentBuildTop.SetIconVisible(true);
     }
     else
     {
         this.m_currentBuildTop = null;
     }
     foreach (var kv in m_topUI)
     {
         for (int i = 0; i < kv.Value.Count; i++)
         {
             if (!kv.Value[i].Equals(currentBuildTop))
             {
                 kv.Value[i].SetIconVisible(!visible);
             }
         }
     }
 }