Ejemplo n.º 1
0
        public override void CreateBackGround()
        {
            counter = 30;

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

            imageList      = new ImageList();
            imageList.Json = jsonData["imagelistInfo"];
            imageList.CreateImageList(canvas);

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

            previewImage = new Image[2];
            for (int i = 0; i < previewImage.Length; i++)
            {
                GameObject obj = new GameObject();
                obj.name = "previewImage";
                obj.transform.SetParent(canvas.transform);

                previewImage[i] = obj.AddComponent <Image> ();
                previewImage[i].rectTransform.anchorMax = Vector2.zero;
                previewImage[i].rectTransform.anchorMin = Vector2.zero;
                previewImage[i].rectTransform.position  = new Vector3(Screen.width / 2f, Screen.height / 2f, 0f);
                previewImage[i].rectTransform.sizeDelta = new Vector2(Screen.width, Screen.height);
                previewImage[i].color = new Color(1, 1, 1, 0);
            }

            previewImage[0].sprite = Resources.Load("UserInterface/fade", typeof(Sprite)) as Sprite;

            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);
            }

            remarkText      = new BaseText();
            remarkText.Json = jsonData["text"];
            remarkText.CreateText(canvas);

            cursor_a.max_number = imageList.textData.Length;
            cursor_a.SetCursorPosition(imageList.ChangeSelectImage(0));
            remarkText.ChangeText(imageList.textData [0]);
        }
Ejemplo n.º 2
0
        public override void CreateBackGround()
        {
            counter = 30;

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

            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);
            }
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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);
        }