コード例 #1
0
        private void CreateTargets()
        {
            if (!targetsContainer)
            {
                return;
            }
            if (!targetPrefab)
            {
                return;
            }

            GUIObjectTargetHelper[] ts = targetsContainer.GetComponentsInChildren <GUIObjectTargetHelper>();
            foreach (var item in ts)
            {
                Destroy(item.gameObject);
            }

            foreach (var item in MBoard.Targets)
            {
                RectTransform         t  = Instantiate(targetPrefab, targetsContainer).GetComponent <RectTransform>();
                GUIObjectTargetHelper th = t.GetComponent <GUIObjectTargetHelper>();
                th.SetData(item.Value, false, true);
                th.SetIcon(MBoard.GOSet.GetObject(item.Value.ID).GuiImage);
                item.Value.ChangeCountEvent += (td) => { if (this)
                                                         {
                                                             th.SetData(td, false); th.gameObject.SetActive(td.NeedCount > 0);
                                                         }
                };
                th.gameObject.SetActive(item.Value.NeedCount > 0);
            }
        }
コード例 #2
0
        internal void RefreshTargets()
        {
            if (GameBoard.Instance && GameBoard.Instance.WController != null)
            {
                int       c     = 0;
                int       tc    = 0;
                LevelType lType = GameBoard.Instance.WController.GameLevelType;
                GameBoard.Instance.WController.GetCurrTarget(out c, out tc);
                targetFish.gameObject.SetActive(lType == LevelType.FishLevel);
                targetLopTopRow.gameObject.SetActive(lType == LevelType.LoopTopRowLevel);
                targetRaiseAcnhor.gameObject.SetActive(lType == LevelType.AnchorLevel);
                targetClock.gameObject.SetActive(lType == LevelType.TimeLevel);

                switch (lType)
                {
                case LevelType.LoopTopRowLevel:
                    targetLopTopRow.SetData(c, tc);
                    break;

                case LevelType.TimeLevel:
                    //targetLopTopRow.SetData(c, tc);
                    break;

                case LevelType.AnchorLevel:
                    targetRaiseAcnhor.SetData(c, tc);
                    break;

                case LevelType.FishLevel:
                    targetFish.SetData(c, tc);
                    break;

                default:
                    break;
                }
            }
        }