Beispiel #1
0
        void MakingDefault_MainMenu()
        {
            mainManueObj      = new GameObject();
            mainManueObj.name = "MainMenu";
            mainManueObj.AddComponent <Image>().color = new Color(0.4f, 0.4f, 0.8f, 0.7f);
            mainManueObj.AddComponent <MainManue>();
            mainManueObj.AddComponent <DragPanel>();
            mainManueObj.transform.SetParent(MainCanvasObject.transform);
            RectTransform rectTransform = mainManueObj.GetComponent <RectTransform>();

            rectTransform.Set_DeltaSize_Anchor_ScreenPos(new Vector2(200, 400), new Vector2(0, 0));

            Color buttonColor = new Color(0.0f, 0.8f, 0.5f, 1.0f);

            V.UIHelper.VAnchorRect rect = new V.UIHelper.VAnchorRect(0.05f, 0.85f, 0.95f, 0.95f);

            Create_Button_TEXT <NewGameButton>(mainManueObj.transform, "New Game", buttonColor, null, rect, 14, Color.red, null);

            rect.MoveVertical(-0.15f);
            SwitchPanelButton switchToLoad = Create_Button_TEXT <SwitchPanelButton>(mainManueObj.transform, "Load", buttonColor, null, rect, 14, Color.red, null);

            switchToLoad.target = PanelType.LoadSave;

            rect.MoveVertical(-0.15f);
            SwitchPanelButton switchToSave = Create_Button_TEXT <SwitchPanelButton>(mainManueObj.transform, "Save", buttonColor, null, rect, 14, Color.red, null);

            switchToSave.target = PanelType.LoadSave;

            rect.MoveVertical(-0.15f);
            SwitchPanelButton switchToSetting = Create_Button_TEXT <SwitchPanelButton>(mainManueObj.transform, "Setting", buttonColor, null, rect, 14, Color.red, null);

            switchToSetting.target = PanelType.Setting;

            rect.MoveVertical(-0.3f);
            rect.ScaleVertical_Mid(0.7f);
            rect.ScaleHorizontal_Mid(0.3f);

            rect.MoveHorizontal(-0.2f);
            Create_Button_TEXT <SysButton>(mainManueObj.transform, "Resume", buttonColor, null, rect, 14, Color.red, null);

            rect.MoveHorizontal(0.4f);
            Create_Button_TEXT <QuitButton>(mainManueObj.transform, "Quit", buttonColor, null, rect, 14, Color.red, null);
        }
Beispiel #2
0
        void MakingDefault_SettingPanel()
        {
            settingPanelObj      = new GameObject();
            settingPanelObj.name = "SettingPanel";
            settingPanelObj.AddComponent <Image>().color = new Color(0.4f, 0.4f, 0.8f, 0.7f);
            settingPanelObj.AddComponent <SettingPanel>();
            settingPanelObj.AddComponent <DragPanel>();
            settingPanelObj.transform.SetParent(MainCanvasObject.transform);
            RectTransform rectTransform = settingPanelObj.GetComponent <RectTransform>();

            //rectTransform.SetDeltaSize_At_ScreenPos(new Vector2(300, 350), new Vector2(0, 0));
            rectTransform.Set_DeltaSize_Anchor_Left_Top(new Vector2(400, 350), new Vector2(20, 20));


            Color imageColor = new Color(173 / (float)255, 173 / (float)255, 240 / (float)255);

            V.UIHelper.VAnchorRect rect = new V.UIHelper.VAnchorRect(0.0f, 0.9f, 1.0f, 1.0f);

            //Setting header Icom, Text, toggle Button
            GameObject imageObj = Create_Image(settingPanelObj.transform, "SettingObj", imageColor, null, rect);

            Create_Text(imageObj.transform, "Setting", 20, Color.red, null, V.UIHelper.VAnchorRect.Fill);
            Create_Button <SettingButton>(imageObj.transform, "SettingButton", Color.green, null, new V.UIHelper.VAnchorRect(0.9f, 0.0f, 1.0f, 1.0f));

            rect.ScaleHorizontal_Mid(0.9f);
            rect.MoveVertical(-0.15f);

            SliderObj masterVolumSlider = Create_Slider_Horizontal(settingPanelObj.transform, "MasterVolumSliderObj", "Master Volum", rect);

            AudioManager.Instance.masterSlider = masterVolumSlider;

            rect.MoveVertical(-0.15f);
            SliderObj sfxVolumSlider = Create_Slider_Horizontal(settingPanelObj.transform, "SFXVolumSliderOBj", "SFX Volum", rect);

            AudioManager.Instance.sfxSlider = sfxVolumSlider;

            rect.MoveVertical(-0.15f);
            SliderObj musicVolumSlider = Create_Slider_Horizontal(settingPanelObj.transform, "MusicVolumSliderOBj", "Music Volum", rect);

            AudioManager.Instance.musicSlider = musicVolumSlider;
        }