コード例 #1
0
    private void Create()
    {
        if (UpdateController.themeName != "GlobalMapTheme")
        {
            if (UpdateController.theme != null)
            {
                AudioController.instance.RemoveAudio(UpdateController.theme);
            }

            UpdateController.theme     = AudioController.instance.CreateAudio("GlobalMapTheme", true, true);
            UpdateController.themeName = "GlobalMapTheme";
        }

        var background0 = new GUIImage();

        background0.texture          = Resources.Load("Interface/StartMenu/Background0") as Texture;
        background0.layer            = -5;
        background0.sizeInMeters     = new Vector2(-1, -1);
        background0.positionInMeters = new Vector2(0, 0) * Settings.FhdToHD;

        var background1 = new GUIImage();

        background1.texture          = Resources.Load("Interface/StartMenu/Background1") as Texture;
        background1.layer            = -3;
        background1.sizeInMeters     = new Vector2(-1, -1);
        background1.positionInMeters = new Vector2(0, 0) * Settings.FhdToHD;

        var greenWater = new GUIButtonAlpha();

        greenWater.texture          = Resources.Load("Interface/StartMenu/GreenWater") as Texture;
        greenWater.layer            = -4;
        greenWater.sizeInMeters     = new Vector2(-1, -1);
        greenWater.positionInMeters = new Vector2(16.73f, -7.5f) * Settings.FhdToHD;
        greenWater.gameObject.name += "Through";
        greenWater.OnClick          = (t) => {
            MakeBubble();
        };

        var red = new GUIImage();

        red.texture          = Resources.Load("Interface/StartMenu/Red") as Texture;
        red.layer            = -4;
        red.sizeInMeters     = new Vector2(-1, -1);
        red.positionInMeters = new Vector2(-3.94f, -0.25f) * Settings.FhdToHD;

        var green = new GUIImage();

        green.texture          = Resources.Load("Interface/StartMenu/Green") as Texture;
        green.layer            = -4;
        green.sizeInMeters     = new Vector2(-1, -1);
        green.positionInMeters = new Vector2(6.02f, -0.25f) * Settings.FhdToHD;



        var redHotspot = new GUIImage();

        redHotspot.texture          = Resources.Load("Interface/StartMenu/Hotspot") as Texture;
        redHotspot.layer            = -3.9f;
        redHotspot.sizeInMeters     = new Vector2(-1, -1);
        redHotspot.positionInMeters = new Vector2(-4.24f, -0.19f) * Settings.FhdToHD;

        var greenHotspot = new GUIImage();

        greenHotspot.texture          = Resources.Load("Interface/StartMenu/Hotspot") as Texture;
        greenHotspot.layer            = -3.9f;
        greenHotspot.sizeInMeters     = new Vector2(-1, -1);
        greenHotspot.positionInMeters = new Vector2(5.73f, -0.19f) * Settings.FhdToHD;

        startArrow                  = new GUIImage();
        startArrow.texture          = Resources.Load("Interface/StartMenu/Arrow1") as Texture;
        startArrow.layer            = -3.8f;
        startArrow.sizeInMeters     = new Vector2(-1, -1);
        startArrow.positionInMeters = new Vector2(1.06f, -2.22f) * Settings.FhdToHD;

        secondArrow                  = new GUIImage();
        secondArrow.texture          = Resources.Load("Interface/StartMenu/Arrow0") as Texture;
        secondArrow.layer            = -3.8f;
        secondArrow.sizeInMeters     = new Vector2(-1, -1);
        secondArrow.positionInMeters = new Vector2(-6.9f, 7.74f) * Settings.FhdToHD;

        start                  = new GUIButton();
        start.texture          = Resources.Load("$" + Settings.language + "/Interface/StartMenu/Start") as Texture;
        start.layer            = -2;
        start.sizeInMeters     = new Vector2(-1, -1);
        start.positionInMeters = new Vector2(1.08f, -5.3f) * Settings.FhdToHD;
        start.OnButtonDown     = (t) => {
            start.texture = Resources.Load("$" + Settings.language + "/Interface/StartMenu/StartPushed") as Texture;
        };
        start.OnButtonUp = (t) => {
            start.texture = Resources.Load("$" + Settings.language + "/Interface/StartMenu/Start") as Texture;
        };
        start.OnClick = (t) => {
            if (!GamePullController.isPreordered)
            {
                var toPreorder = new List <GamePullController.PreoderItem> ();

                toPreorder.Add(new GamePullController.PreoderItem("GUIImage", 70, () => {}));
                toPreorder.Add(new GamePullController.PreoderItem("Text", 10, () => {}));
                toPreorder.Add(new GamePullController.PreoderItem("GUIImageAlpha", 4, () => {}));
                //toPreorder.Add (new GamePullController.PreoderItem ("Audio", 0, () => {}));

                GamePullController.Preorder(toPreorder, (done, total) => {
                    loaded = done * 1f / total;
                }, () => {
                    isNextSceneLoaded = true;
                });
            }
            else
            {
                UpdateController.LaunchIt(10, 0.02f, (q) => {
                    loaded = q / 9f;
                }, () => {
                    isNextSceneLoaded = true;
                });
            }
        };


        cogwheel1                  = new GUIImage();
        cogwheel1.texture          = Resources.Load("Interface/StartMenu/Cogwheel1") as Texture;
        cogwheel1.layer            = -4.9f;
        cogwheel1.sizeInMeters     = new Vector2(-1, -1);
        cogwheel1.positionInMeters = new Vector2(16.52f, 7.42f) * Settings.FhdToHD;

        cogwheel2                  = new GUIImage();
        cogwheel2.texture          = Resources.Load("Interface/StartMenu/Cogwheel2") as Texture;
        cogwheel2.layer            = -4;
        cogwheel2.sizeInMeters     = new Vector2(-1, -1);
        cogwheel2.positionInMeters = new Vector2(13.82f, 3.25f) * Settings.FhdToHD;

        cogwheel3                  = new GUIImage();
        cogwheel3.texture          = Resources.Load("Interface/StartMenu/Cogwheel0") as Texture;
        cogwheel3.layer            = -4;
        cogwheel3.sizeInMeters     = new Vector2(-1, -1);
        cogwheel3.positionInMeters = new Vector2(9.38f, 9.05f) * Settings.FhdToHD;


        text                  = new GUIImage();
        text.texture          = Resources.Load("$" + Settings.language + "/Interface/StartMenu/Text") as Texture;
        text.layer            = -2;
        text.sizeInMeters     = new Vector2(-1, -1);
        text.positionInMeters = new Vector2(-14.63f, 7.67f) * Settings.FhdToHD;


        var englishBox = new GUIButton();

        englishBox.texture          = Resources.Load("$English/Interface/StartMenu/Box") as Texture;
        englishBox.layer            = -2;
        englishBox.sizeInMeters     = new Vector2(-1, -1);
        englishBox.positionInMeters = new Vector2(-14.63f, 0.5f) * Settings.FhdToHD;
        englishBox.OnButtonDown     = (t) => {
            englishBox.texture = Resources.Load("$English/Interface/StartMenu/BoxPushed") as Texture;
        };
        englishBox.OnButtonUp = (t) => {
            englishBox.texture = Resources.Load("$English/Interface/StartMenu/Box") as Texture;
        };
        englishBox.OnClick = (t) => {
            if (Settings.language == "English")
            {
                return;
            }

            RotateSecondArrow();
            Settings.language = "English";
            UpdateLanguage();
        };

        var russianBox = new GUIButton();

        russianBox.texture          = Resources.Load("$Russian/Interface/StartMenu/Box") as Texture;
        russianBox.layer            = -2;
        russianBox.sizeInMeters     = new Vector2(-1, -1);
        russianBox.positionInMeters = new Vector2(-14.63f, -4.8f) * Settings.FhdToHD;
        russianBox.OnButtonDown     = (t) => {
            russianBox.texture = Resources.Load("$Russian/Interface/StartMenu/BoxPushed") as Texture;
        };
        russianBox.OnButtonUp = (t) => {
            russianBox.texture = Resources.Load("$Russian/Interface/StartMenu/Box") as Texture;
        };
        russianBox.OnClick = (t) => {
            if (Settings.language == "Russian")
            {
                return;
            }

            RotateSecondArrow();
            Settings.language = "Russian";
            UpdateLanguage();
        };


        selection                  = new GUIImage();
        selection.texture          = Resources.Load("Interface/StartMenu/Selection") as Texture;
        selection.layer            = -1.5f;
        selection.sizeInMeters     = new Vector2(-1, -1);
        selection.positionInMeters = new Vector2(-14.613f, 1.78f) * Settings.FhdToHD;

        UpdateLanguage();

        UpdateController.Timer(0.1f, () => {
            new OptionsController(() => {
                Application.Quit();
            }, null, false);
        });

        loadingPosition           = 0;
        loaded                    = 0;
        cogwheelsRotation         = 0;
        secondArrowRotation       = 0;
        secondArrowTargetRotation = 0;
        secondArrowSpeed          = 0.2f;
        secondArrowCooldown       = secondArrowMaxCooldown;
        bubblesCooldown           = bubblesMaxCooldown;
    }