Exemple #1
0
        public override void CreateBackGround()
        {
            counter = 30;

            TextAsset jsonAsset = Resources.Load("Data/StageSelectUIData", typeof(TextAsset)) as TextAsset;
            JsonData  jsonData  = JsonMapper.ToObject(jsonAsset.text);

            cursor      = new Cursor();
            cursor.Json = jsonData["cursor"];
            cursor.CreateMenuItem(canvas);
            cursor.StartAnimation(new float[1] {
                1
            }, (float)counter);
            labelList.Add(cursor);

            explanatoryText = new ChangeLabel();
            //explanatoryText.Json = jsonData["explanatoryText"];
            labelList.Add(explanatoryText);

            string[] files = new string[dataManager.stageData.Length];
            for (int i = 0; i < files.Length; i++)
            {
                if (dataManager.stageData[i].open)
                {
                    files[i] = dataManager.stageData[i].labelInfo.stageImageFile;
                }
                else
                {
                    files[i] = "stage_silhouette";
                }
            }
            Image img = canvas.gameObject.transform.Find("Image").GetComponent <Image> ();

            explanatoryText.CreateVariableItem(img, files);

            JsonData[] jsonArray = JsonMapper.ToObject <JsonData[]> (jsonData["labels"].ToJson());
            foreach (JsonData array in jsonArray)
            {
                AnimationLabel label = new AnimationLabel();
                label.Json = array;
                labelList.Add(label);
                label.CreateMenuItem(canvas);
                label.StartAnimation(new float[1] {
                    1
                }, (float)counter);
            }

            JsonData data = jsonData["buttonInfo"];

            buttonsInfo       = new ButtonsInfo[dataManager.stageData.Length];
            cursor.max_number = buttonsInfo.Length;
            cursor.select     = 2;

            for (int i = 0; i < buttonsInfo.Length; i++)
            {
                buttonsInfo[i].position = new Vector2((int)data["position_x"] + (int)data["distance_x"] * i, (int)data["position_y"] + (int)data["distance_y"] * i);
                buttonsInfo[i].size     = new Vector2((int)data["width"], (int)data["height"]);
                buttonsInfo[i].alpha    = JsonMapper.ToObject <float[]> (data["alpha"].ToJson());
                buttonsInfo[i].pivot    = JsonMapper.ToObject <float[]> (data["pivot"].ToJson());
            }

            buttonsInfo[2].size  = new Vector2((int)data["select_width"], (int)data["select_height"]);
            buttonsInfo[2].alpha = JsonMapper.ToObject <float[]> (data["select_alpha"].ToJson());
            buttonsInfo[0].alpha = new float[2] {
                0, 0
            };
            for (int i = 5; i < buttonsInfo.Length; i++)
            {
                buttonsInfo[i].alpha = new float[2] {
                    0, 0
                };
            }

            for (int i = 0; i < 2; i++)
            {
                AnimationButton button = new AnimationButton();
                buttonList.Add(button);
                button.SetID(dataManager.stageData.Length - i - 1);
                button.CreateMenuItem(canvas, buttonsInfo[i], dataManager.stageData[dataManager.stageData.Length - i - 1].labelInfo,
                                      dataManager.stageData[dataManager.stageData.Length - i - 1].open);
                button.StartAnimation(buttonsInfo[i], (float)counter);
                button.order = i;
            }


            for (int i = 0; i < dataManager.stageData.Length - 2; i++)
            {
                AnimationButton button = new AnimationButton();
                buttonList.Add(button);
                button.SetID(i);
                button.CreateMenuItem(canvas, buttonsInfo[i + 2], dataManager.stageData[i].labelInfo,
                                      dataManager.stageData[i].open);
                button.StartAnimation(buttonsInfo[i + 2], (float)counter);
                button.order = i + 2;
            }

            explanatoryText.ChangeSprite(buttonList[cursor.select].id);
        }
Exemple #2
0
        public override void CreateBackGround()
        {
            counter = 30;

            TextAsset jsonAsset = Resources.Load("Data/TitleUIData", typeof(TextAsset)) as TextAsset;
            JsonData  jsonData  = JsonMapper.ToObject(jsonAsset.text);

            cursor      = new Cursor();
            cursor.Json = jsonData["cursor"];
            cursor.CreateMenuItem(canvas);
            cursor.StartAnimation(new float[1] {
                1
            }, (float)counter);
            labelList.Add(cursor);

            explanatoryText      = new ChangeLabel();
            explanatoryText.Json = jsonData["explanatoryText"];
            explanatoryText.CreateMenuItem(canvas);
            explanatoryText.StartAnimation(new float[1] {
                1
            }, (float)counter);
            labelList.Add(explanatoryText);

            JsonData[] jsonArray = JsonMapper.ToObject <JsonData[]> (jsonData["labels"].ToJson());
            foreach (JsonData array in jsonArray)
            {
                AnimationLabel label = new AnimationLabel();
                label.Json = array;
                labelList.Add(label);
                label.CreateMenuItem(canvas);
                label.StartAnimation(new float[1] {
                    1
                }, (float)counter);
            }

            JsonData data = jsonData["buttonInfo"];

            jsonArray = JsonMapper.ToObject <JsonData[]> (jsonData["buttons"].ToJson());

            buttonsInfo       = new ButtonsInfo[jsonArray.Length + 1];
            cursor.max_number = buttonsInfo.Length;
            cursor.select     = 2;

            for (int i = 0; i < buttonsInfo.Length; i++)
            {
                buttonsInfo[i].position = new Vector2((int)data["position_x"] + (int)data["distance_x"] * i, (int)data["position_y"] + (int)data["distance_y"] * i);
                buttonsInfo[i].size     = new Vector2((int)data["width"], (int)data["height"]);
                buttonsInfo[i].alpha    = JsonMapper.ToObject <float[]> (data["alpha"].ToJson());
                buttonsInfo[i].pivot    = JsonMapper.ToObject <float[]> (data["pivot"].ToJson());
            }

            buttonsInfo[2].size  = new Vector2((int)data["select_width"], (int)data["select_height"]);
            buttonsInfo[2].alpha = JsonMapper.ToObject <float[]> (data["select_alpha"].ToJson());
            buttonsInfo[0].alpha = new float[2] {
                0, 0
            };
            buttonsInfo[buttonsInfo.Length - 1].alpha = new float[2] {
                0, 0
            };

            for (int i = 0; i < 2; i++)
            {
                AnimationButton button = new AnimationButton();
                button.Json = jsonArray[jsonArray.Length - 1 - i];
                buttonList.Add(button);
                button.CreateMenuItem(canvas, buttonsInfo[i]);
                button.StartAnimation(buttonsInfo[i], (float)counter);
                button.order = i;
            }

            for (int i = 0; i < jsonArray.Length - 1; i++)
            {
                AnimationButton button = new AnimationButton();
                button.Json = jsonArray[i];
                buttonList.Add(button);
                button.CreateMenuItem(canvas, buttonsInfo[i + 2]);
                button.StartAnimation(buttonsInfo[i + 2], (float)counter);
                button.order = i + 2;
            }

            explanatoryText.ChangeSprite(buttonList[cursor.select].id);
        }