コード例 #1
0
 void ItemClicked(UIItem item)
 {
     if (item.GetName() == "BtnStartGame")
     {
         SetVisibility(false);
         LevelManager.pInstance.BeginGame();
     }
 }
コード例 #2
0
 public void ItemClicked(UIItem item)
 {
     if (item.HasName(_ItemName))
     {
         Debug.Log("Executing the next step " + item.GetName());
         End();
         mTutorialManager.NextStep();
     }
 }
コード例 #3
0
    void ItemClicked(UIItem item)
    {
        _DropDownMenu.SetVisibility(false);

        if (item.GetName() != "Export")
        {
            TileData itemData = (TileData)item.GetItemData();

            GameObject newGameObject = (GameObject)GameObject.Instantiate(itemData._TileObject.gameObject);
            newGameObject.name             = itemData._TileObject.name;
            newGameObject.transform.parent = mLevelTransformParent;

            Vector3 worldPoint = Camera.main.ScreenToWorldPoint(mClickPos);
            worldPoint.z = 0;
            worldPoint.x = Mathf.Round(worldPoint.x);
            worldPoint.y = Mathf.Round(worldPoint.y);
            newGameObject.transform.position = worldPoint;
        }
        else
        {
            GameObject obj       = new GameObject("NewData");
            LevelData  levelData = obj.AddComponent <LevelData>();

            int childCount = mLevelTransformParent.childCount;
            levelData._LevelInfo = new LevelData.LevelInfo[childCount];

            for (int i = 0; i < childCount; i++)
            {
                Transform child = mLevelTransformParent.GetChild(i);

                for (int j = 0; j < _TileData.Length; j++)
                {
                    if (child.name == _TileData[j]._TileObject.name)
                    {
                        levelData._LevelInfo[i]            = new LevelData.LevelInfo();
                        levelData._LevelInfo[i]._Transform = _TileData[j]._TileObject;
                        levelData._LevelInfo[i]._Pos       = new Vector2(child.position.x, child.position.y);
                        break;
                    }
                }
            }
        }

        mCurrentFrame = Time.frameCount;
    }