Пример #1
0
    // Start is called before the first frame update
    void Start()
    {
        var sname = SceneSelector.GetCurrentSceneName();

        if (sname != null)
        {
            var laststage = StageAchievement.GetLastStageSceneName(sname);
            {
                if (laststage != null)
                {
                    foreach (Transform worldstage in transform)
                    {
                        var stageSelectable = worldstage.GetComponentInChildren <StageSelectable>();
                        var stage           = stageSelectable?.stage;
                        if (stage != null)
                        {
                            if (laststage == stage.sceneName)
                            {
                                current = stageSelectable;
                                current?.GetComponent <Selectable>()?.Select();
                                return;
                            }
                        }
                    }
                }
                if (transform.childCount > 0)
                {
                    var stageSelectable = transform.GetChild(0).GetComponentInChildren <StageSelectable>();
                    current = stageSelectable;
                    current?.GetComponent <Selectable>()?.Select();
                }
            }
        }
    }
Пример #2
0
        public static PreferencesWindow Open(SceneSelector owner)
        {
            var window = GetWindow <PreferencesWindow>(true, kWindowCaption, true);

            window.Init(owner);
            return(window);
        }
Пример #3
0
 public void SelectStage()
 {
     if (SceneSelector.Get().LoadScene("SelectScene"))
     {
         TitleEffect(false);
     }
 }
Пример #4
0
        public static void OnGameStart()
        {
            SceneSelector selector = null;

            foreach (var scene in ContentProvider.GetAvailableContent <Scene>())
            {
                selector = scene.Res?.FindComponent <SceneSelector>() ?? selector;
            }

            if (selector == null)
            {
                Logs.Game.WriteWarning("Unable to set scenes, SceneSelector not found.");
            }
            else
            {
                _gameScene = selector.Game;
                _menuScene = selector.Menu;


                if (_gameScene.Res == null || _menuScene.Res == null)
                {
                    Logs.Game.WriteWarning("Scene Selector ContentRefs aren't available, unable to set scenes.");
                }
            }

            OldContext.ClearNotifications();
        }
Пример #5
0
    // Start is called before the first frame update
    private void Start()
    {
        var name = SceneSelector.GetCurrentSceneName();

        if (name != null)
        {
            var music = MusicController.Get();
            if (music != null)
            {
                int bgmId    = name.GetHashCode();
                var selector = SceneSelector.Get();
                if (selector != null && selector.CurrentScene is Stage)
                {
                    var id = ((Stage)selector.CurrentScene).bgmId;
                    if (id >= 0)
                    {
                        bgmId = id;
                    }
                }
                ;

                music.ChangeSound(music.PG[(bgmId % music.PG.Length + music.PG.Length) % music.PG.Length]);
            }
        }

        pointManager = GetComponent <PointManager>();
        camType      = CameraType.ShowWorld;

        this.Delay(.1f, () =>
        {
            CameraController.Get().Targetter.SetTarget(GetComponentInChildren <GoalController>().goalTarget);
        });
        StartGame();
    }
Пример #6
0
    public static void CommandLineBuild()
    {
        EditorApplication.Beep();
        EditorApplication.Beep();
        EditorApplication.Beep();
        EditorApplication.Beep();
        EditorApplication.Beep();
        EditorApplication.Beep();
        EditorApplication.Beep();
        EditorApplication.Beep();
        EditorApplication.Beep();
        EditorApplication.Beep();
        EditorApplication.Beep();

        //make sure the recompiled scripts are reimported
        AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate | ImportAssetOptions.ImportRecursive);

        //make a new scene
        EditorApplication.NewScene();

        //set the scene up with the single game object we have
        SceneSelector.LoadHangoutScene();

        //save the scene out
        EditorApplication.SaveScene(Application.dataPath + "/AutogeneratedScene");

        //set the resolution of the web build
        Screen.SetResolution(760, 500, false);

        //pass scene
        BuildPipeline.BuildPlayer(null, Application.dataPath + "/hangout.unity3d", BuildTarget.WebPlayer, BuildOptions.CompressTextures);
    }
Пример #7
0
    static void Init()
    {
        SceneSelector window = (SceneSelector)EditorWindow.GetWindow(typeof(SceneSelector));

        window.titleContent = new GUIContent("Scene Selector");
        window.Show();
    }
Пример #8
0
 public void BackToTitle()
 {
     if (SceneSelector.Get().LoadScene("TitleScene"))
     {
         SelectEffect(false);
     }
 }
Пример #9
0
    // Start is called before the first frame update
    void Start()
    {
        if (SceneSelector.GetCurrentSceneName().Contains("World"))
        {
            var music = MusicController.Get();
            if (music != null)
            {
                music.ChangeSound(music.TitleBGM);
                music.ApplyParamater("Scene", 2f / 2);
            }
        }
        else
        {
            var music = MusicController.Get();
            if (music != null)
            {
                music.ChangeSound(music.TitleBGM);
                music.ApplyParamater("Scene", 1f / 2);
            }
        }

        if (StageSelector.Get() != null && SceneSelector.Get() != null)
        {
            StageSelector.Get().lastWorldMap = SceneSelector.Get().CurrentScene;
        }
        SelectEffect(true);
    }
Пример #10
0
 // Start is called before the first frame update
 void Start()
 {
     var sceneSelector = SceneSelector.Get();
     sceneSelector.PushScene();
     sceneSelector.LoadScene(new SceneStage("StageScene"));
     sceneSelector.PushScene();
     sceneSelector.LoadScene(new SceneStage("TitleScene"));
 }
Пример #11
0
    public static SceneSelector ShowDialog(AssetsManager am, List <string> scenes, string gameDataPath)
    {
        SceneSelector window = GetWindow <SceneSelector>();

        window.am           = am;
        window.strings      = scenes.ToArray();
        window.gameDataPath = gameDataPath;
        return(window);
    }
Пример #12
0
            private void OpenKingdomSelector(object sender, EventArgs args)
            {
                SceneSelector sceneSelect = new SceneSelector();

                sceneSelect.LoadDictionary(SMO_Scene.OdysseyStages);
                if (sceneSelect.ShowDialog() == DialogResult.OK)
                {
                    SMO_Scene.LoadStage(sceneSelect.SelectedFile);
                }
            }
Пример #13
0
    public void MenuTitle()
    {
        var sel = SceneSelector.Get();

        if (sel != null)
        {
            sel.LoadScene(new SceneStage("TitleScene"), SceneSelector.SceneChangeType.CHANGE_FADE);
        }
        MenuEffect(false);
    }
Пример #14
0
    public void MenuRestart()
    {
        var sel = SceneSelector.Get();

        if (sel != null)
        {
            sel.LoadScene(sel.CurrentScene, SceneSelector.SceneChangeType.CHANGE_FADE);
        }
        MenuEffect(false);
    }
Пример #15
0
    public void MenuWorld()
    {
        var sel = SceneSelector.Get();
        var sta = StageSelector.Get();

        if (sel != null && sta != null)
        {
            sel.LoadScene(sta.lastWorldMap, SceneSelector.SceneChangeType.CHANGE_FADE);
        }
        MenuEffect(false);
    }
Пример #16
0
 public void LoadNextStage()
 {
     if (currentStage && currentStage.nextStage)
     {
         LoadStage(currentStage.nextStage);
     }
     else
     {
         SceneSelector.Get().LoadScene("SelectScene");
     }
 }
    private void SetHighScore()
    {
        int           highScore = 0;
        SceneSelector selecter  = root.GetComponent <SceneSelector>();

        if (selecter)
        {
            highScore = selecter.HighScore();
        }
        ui.BroadcastMessage("OnAddScore", highScore);
    }
Пример #18
0
    public void OnSelect(BaseEventData eventData)
    {
        var sname = SceneSelector.GetCurrentSceneName();

        if (stage != null && !(sname.Contains("World") && stage.SceneName.Contains("World")))
        {
            StageAchievement.SetLastStage(sname, stage);
        }
        SelectDirector.Get(transform).SetSelected(stage);
        SelectDirector.Get(transform).SetSelected(gameObject);
    }
Пример #19
0
 public void BackToTitle()
 {
     if (SceneSelector.GetCurrentSceneName().Contains("World"))
     {
         SceneSelector.Get().LoadScene(new SceneStage("TitleScene"), SceneSelector.SceneChangeType.CHANGE_FADE);
     }
     else
     {
         SceneSelector.Get().LoadScene(new SceneStage("TitleScene"), SceneSelector.SceneChangeType.CHANGE_MOVE);
     }
     SelectEffect(false);
 }
Пример #20
0
 private void Awake()
 {
     if (!instance)
     {
         instance = this;
         DontDestroyOnLoad(this.gameObject);
     }
     else if (instance != this)
     {
         Destroy(this.gameObject);
     }
 }
Пример #21
0
    // Use this for initialization
    void Awake()
    {
        sceneSelector     = FindObjectOfType <SceneSelector>();
        originalResetTime = resetTime;

        SceneManager.activeSceneChanged += delegate(Scene sceneOriginal, Scene sceneNew)
        {
            StopAllCoroutines();
            StartCoroutine(ResetOnNewScene());
        };

//        ResetOnNewScene();
    }
Пример #22
0
    public void StartGame(Stage stage)
    {
        Stage sstage = (stage.story != null /* && !StageAchievement.isCreativeMode*/) ? stage.story : stage;

        if (SceneSelector.GetCurrentSceneName().Contains("World"))
        {
            StageSelector.Get().LoadStage(sstage, SceneSelector.SceneChangeType.CHANGE_FADE);
        }
        else
        {
            StageSelector.Get().LoadStage(sstage, SceneSelector.SceneChangeType.CHANGE_MOVE);
        }
        SelectEffect(false);
    }
Пример #23
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetButtonDown("Cancel"))
     {
         if (SceneSelector.GetCurrentSceneName().Contains("World"))
         {
             BackToSelect();
         }
         else
         {
             BackToTitle();
         }
     }
 }
Пример #24
0
    public void StartGame()
    {
        var sel = SceneSelector.Get();

        if (sel != null)
        {
            if (sel.CurrentScene is Stage)
            {
                var stage = (Stage)sel.CurrentScene;
                sel.LoadScene(stage.afterStory, SceneSelector.SceneChangeType.CHANGE_FADE);
            }
        }
        StoryEffect(false);
    }
Пример #25
0
    private void OnEnable()
    {
        if (Application.isPlaying)
        {
            return;
        }

        staticTarget = ( SceneSelector )target;

        header = serializedObject.FindProperty("header");

        PrependFirstScene();

        //UpdateTargetScenes();
        //UpdateTargetLoader();
    }
Пример #26
0
 public UIManager(Game game, SpriteBatch spriteBatch, ImGuiRenderer gui, RenderTargetDescriber renderTargetDescriber, SceneSelector sceneSelector, EntityController entityController, CameraController cameraController, Editors editors, IList <IMenu> menus, EntityWindow entityWindow, NetWindow netWindow, KeyboardInput keyboardInput, MouseInput mouseInput)
 {
     this.Gui                   = gui;
     this.KeyboardInput         = keyboardInput;
     this.MouseInput            = mouseInput;
     this.GameLoop              = game;
     this.SpriteBatch           = spriteBatch;
     this.CameraController      = cameraController;
     this.RenderTargetDescriber = renderTargetDescriber;
     this.SceneSelector         = sceneSelector;
     this.EntityController      = entityController;
     this.Menus                 = menus;
     this.EntityWindow          = entityWindow;
     this.NetWindow             = netWindow;
     this.Editors               = editors;
 }
Пример #27
0
 public void StageAchieveEffect(bool starting)
 {
     if (stageAchieve)
     {
         var sel  = SceneSelector.Get()?.CurrentScene;
         var text = sel is Stage ? ((Stage)sel).answer : "";
         stageAchieve.GetComponent <Animator>().SetBool("Enabled", starting && text != "");
         if (starting)
         {
             var title = stageAchieve.GetComponentInChildren <TMP_Text>();
             if (title)
             {
                 title.text = text;
             }
         }
     }
 }
Пример #28
0
    public bool LoadStage(Stage stage)
    {
        if (currentStage != stage)
        {
            SceneSelector.Get().LoadScene(stage.sceneName);
            currentStage = stage;

            BaseDirector.Get()?.StageChangeEffect(true);
            this.Delay(2, () =>
            {
                BaseDirector.Get()?.StageChangeEffect(false);
            });

            return(true);
        }
        return(false);
    }
Пример #29
0
    // Start is called before the first frame update
    void Start()
    {
        var sel = SceneSelector.Get();
        var sta = StageSelector.Get();

        if (sel != null && sta != null)
        {
            sta.lastWorldMap = sel.CurrentScene;
        }
        var music = MusicController.Get();

        if (music != null)
        {
            music.ChangeSound(music.TitleBGM);
            music.ApplyParamater("Scene", 0f / 2);
        }

        TitleEffect(true);

        CameraController.Get().Targetter.SetTarget(fixedPin);
    }
Пример #30
0
    public static void OpenSceneByName()
    {
        AssetsManager am = new AssetsManager();

        am.LoadClassPackage(Path.Combine(Application.dataPath, "cldb.dat"));

        string gameDataPath = GetGamePath();

        AssetsFileInstance inst          = am.LoadAssetsFile(Path.Combine(gameDataPath, "globalgamemanagers"), false);
        AssetFileInfoEx    buildSettings = inst.table.getAssetInfo(11);

        List <string>       scenes     = new List <string>();
        AssetTypeValueField baseField  = am.GetATI(inst.file, buildSettings).GetBaseField();
        AssetTypeValueField sceneArray = baseField.Get("scenes").Get("Array");

        for (uint i = 0; i < sceneArray.GetValue().AsArray().size; i++)
        {
            scenes.Add(sceneArray[i].GetValue().AsString() + "[" + i + "]");
        }
        SceneSelector sel = SceneSelector.ShowDialog(am, scenes, gameDataPath);
    }
Пример #31
0
 void Awake()
 {
     instance = this;
 }