Beispiel #1
0
    private static IEnumerator LoadImpl(StageDeploy deploy, Action <StageBase> finishAction)
    {
        StageBase gameScene = null;

        yield return(UnloadCurrentScene());

        var sceneName = Path.GetFileNameWithoutExtension(deploy.resource);

#if UNITY_EDITOR
        yield return(SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Additive));
#else
        yield return(ResourceMgr.LoadScene(deploy.resource, LoadSceneMode.Additive));
#endif
        CurrentSceneName = sceneName;
        SceneManager.SetActiveScene(SceneManager.GetSceneByName(sceneName));
        GameEventCenter.Send(GameEvent.OnSceneChange);

        //挂脚本
        var typeScene   = GetSceneType(deploy.levelClass);
        var sceneObject = new GameObject("GameScene");
        var scene       = sceneObject.AddComponent(typeScene) as StageBase;
        scene.Deploy = deploy;
        yield return(scene.Init());

        finishAction?.Invoke(gameScene);
    }
Beispiel #2
0
 protected virtual void OnDestroy()
 {
     StopAllCoroutines();
     GameSystem.ClearCache();
     UiManager.BackGround.SetActiveSafe(true);
     ActiveLevel = null;
 }
Beispiel #3
0
        public void MakeNewHandler(TreasureStage newStage, bool runInit)
        {
            if (CurrentStageHandler != null)
            {
                CurrentStageHandler.Destroy(false);
                CurrentStageHandler = null;
            }

            switch (newStage)
            {
            case TreasureStage.SearchingNote:
                CurrentStageHandler = new SearchingNoteStage();
                break;

            case TreasureStage.SearchingClues:
                CurrentStageHandler = new SearchingCluesStage();
                break;

            case TreasureStage.SearchingChest:
                CurrentStageHandler = new SearchingChestStage();
                break;

            case TreasureStage.Found:
                CurrentStageHandler = new FoundStage();
                break;

            default:
                throw new NotImplementedException("Not implemented stage used with MakeNewHandler.");
            }

            if (runInit)
            {
                CurrentStageHandler?.Init(false);
            }
        }
Beispiel #4
0
    public void ChangeState(GameStateType pState)
    {
        if (SceneManager.Instance.IsSceneLoadiing())
        {
            Debuger.Log("System busy");
            return;
        }
        if (null != m_CurrentStage)
        {
            m_CurrentStage.EndStage();
        }
        m_CurrentStage = null;
        if (!m_StageHandlerStore.TryGetValue(pState, out m_CurrentStage))
        {
            m_CurrentStage = Activator.CreateInstance(m_StageHandlerFactoryStore[pState], pState) as StageBase;
            m_StageHandlerStore.Add(pState, m_CurrentStage);
        }
        Time.timeScale = 1.0f;

        //send msg
        MessageDispatcher.Instance.BroadcastMessage(new MessageObject(ClientCustomMessageDefine.C_CHANGE_SCENE, null));

        //load scene
        SceneManager.Instance.LoadScene(m_StageSceneStore[pState], m_CurrentStage.StartStage, m_CurrentStage.PreLoadScene, m_CurrentStage.InitStage);
    }
Beispiel #5
0
        static void Main()
        {
            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new Form1());

            string      path     = Application.ExecutablePath;
            EndogineHub endogine = new EndogineHub(path);

            string[] aAvailableStrategies = StageBase.GetAvailableRenderers();
            //Endogine.MdiParent mdiParent = new MdiParent();
            //SetupWindow wndSetup = new SetupWindow(aAvailableStrategies, mdiParent);
            SetupWindow wndSetup = new SetupWindow(aAvailableStrategies, null);

            wndSetup.ShowDialog();

            Main main = new Main();

            main.Show();

            endogine.Init(main, null, null);
            main.EndogineInitDone();

            MusicGame.Midi.Main game = new MusicGame.Midi.Main();

            while (endogine.MainLoop())
            {
                Application.DoEvents();
            }
        }
Beispiel #6
0
    //加载关卡
    private static IEnumerator EnterMission()
    {
        //加载Loading
        yield return(GameSystem.ShowLoading());

        yield return(Yielders.Frame);

        //加载关卡
        yield return(StageBase.Load(Data.CurLevelId));

        yield return(Yielders.Frame);

        //加载UI
        UiManager.Show <UIBattle>();

        //cacheSound
        yield return(Sound.CacheAllBgm());

        //加载角色
        yield return(Player.Create(Data.PlayerId, player =>
        {
            player.transform.position = Data.PlayerBornPos;
            MainPlayer = player;
        }));

        //cacheBgm
        Sound.CacheAllBgm();

        //关闭loading
        yield return(GameSystem.HideLoading());
    }
Beispiel #7
0
 private void Main_Aborted(object sender, EventArgs e)
 {
     if (CurrentStageHandler != null)
     {
         CurrentStageHandler.Destroy(true);
         CurrentStageHandler = null;
     }
 }
 //根据节奏射击
 public void SetPlaneShootByRhythm(StageBase stage)
 {
     if (curEmitter != null)
     {
         curEmitter.isShootByRhythm = true;
     }
     stage.StageBulletRhythmEvent += ShootImmediately;
 }
Beispiel #9
0
 public static GitStage <T> GitModul <T>(this StageBase <string, T> input)
     where T : class
 {
     if (input is null)
     {
         throw new ArgumentNullException(nameof(input));
     }
     return(new GitStage <T>(input.DoIt, input.Context));
 }
Beispiel #10
0
    //初始化关卡道中所有敌人
    //void InitStageEnemyInRoad() {
    //    for (int i = 0; i < StageAudioManager.StageSongPlayer.Song.Notes.Count; i++)
    //    {
    //        string enmeyName = StageAudioManager.StageSongPlayer.Song.Notes[i].StageObjectType.ToString();
    //        if (StageAudioManager.StageSongPlayer.Song.Notes[i].StageObjectType == Note.ObjectType.EnmeyBullet
    //            || StageAudioManager.StageSongPlayer.Song.Notes[i].StageObjectType == Note.ObjectType.Command_ShowStageTitle)
    //        {
    //            //break;
    //        }
    //        else {
    //            GameObject enemy = GameObject.Instantiate(Resources.Load(CommandString.EnemyPrefabPath + enmeyName)) as GameObject;
    //            enemy.name = enmeyName + "_Num" + i;
    //            enemy.transform.parent = Camera.main.gameObject.transform;
    //            enemy.transform.localScale = Vector3.one;
    //            enemy.transform.position = Vector3.zero;
    //            EnemyBase enemyBase = enemy.GetComponent<EnemyBase>();
    //            enemyBase.Dir_CurSpeed = -Vector2.up;
    //            enemyBase.Speed_Cur = 80;
    //            enemyBase.SetSpeedCurve(StageAudioManager.StageSongPlayer.Song.Notes[i].Speed_Curve, StageAudioManager.StageSongPlayer.Song.Notes[i].DirX_Curve, StageAudioManager.StageSongPlayer.Song.Notes[i].DirY_Curve);
    //            enemyBase.setDeadValue(null, StageAudioManager.StageSongPlayer.Song.Notes[i].StageColor);
    //            Vector2 appearPos = GlobalData.ScreenZeroPoint + StageAudioManager.StageSongPlayer.Song.Notes[i].AppearPos;
    //            enemyBase.SetAppear(StageAudioManager.StageSongPlayer.Song.Notes[i].Time - 1, appearPos);
    //            enemy.SetActive(false);
    //            enemylist.Add(enemyBase);
    //        }


    //    }
    //}

    ////初始化关卡音乐数据
    //void InitStageBgmData() {
    //    switch (StageIndex) {
    //        case 1:
    //            stageBgm = Resources.Load(CommandString.BGMPath + "春色小路 ~ the Colorful Alley") as AudioClip;
    //            break;
    //        case 2:
    //            break;
    //        case 3:
    //            break;
    //        case 4:
    //            break;
    //        case 5:
    //            break;
    //        case 6:
    //            break;
    //    }
    //}

    //初始化关卡
    void InitStage()
    {
        stageState = enum_stageState.STATE_InBeforeRoad;
        GlobalData.SetScreenRect(obj_ScreenLeft.position, obj_ScreenTop.position, obj_ScreenRight.position, obj_ScreenBottom.position, obj_RecoverLine.position);
        CurStage         = StageList[StageIndex];
        CurStage.manager = this;
        //InitStageEnemyInRoad();
        //stageSoundPlayer.Play();
    }
Beispiel #11
0
 public static GitRefToFilesStage <T> GitRefToFiles <T>(this StageBase <GitRef, T> input)
     where T : class
 {
     if (input is null)
     {
         throw new ArgumentNullException(nameof(input));
     }
     return(new GitRefToFilesStage <T>(input.DoIt, input.Context));
 }
Beispiel #12
0
        public Form1()
        {
            InitializeComponent();

            GameAreaWidth  = ClientRectangle.Width;
            GameAreaHeight = ClientRectangle.Height;

            nowStage = new SampleStage();
        }
Beispiel #13
0
    private static void SceneEnter(StageBase gameScene)
    {
        if (ActiveLevel != null)
        {
            ActiveLevel.OnDestroy();
        }

        ActiveLevel = gameScene;
    }
Beispiel #14
0
 public static MarkdownToHtmlStage <T> MarkdownToHtml <T>(this StageBase <MarkdownDocument, T> input)
     where T : class
 {
     if (input is null)
     {
         throw new ArgumentNullException(nameof(input));
     }
     return(new MarkdownToHtmlStage <T>(input.DoIt, input.Context));
 }
Beispiel #15
0
 public static TextToStreamStage <T> TextToStream <T>(this StageBase <string, T> input)
     where T : class
 {
     if (input is null)
     {
         throw new ArgumentNullException(nameof(input));
     }
     return(new TextToStreamStage <T>(input.DoIt, input.Context));
 }
Beispiel #16
0
        private async void Form1_Load(object sender, EventArgs e)
        {
            this.DoubleBuffered = true;

            label1.Text = "(" + GameMaster.Player.X + "," + GameMaster.Player.Y + ")";

            var stage = new SampleStage();

            nowStage = stage;

            stage.PreparationStage();
            await nowStage.PlayStageAsync().ConfigureAwait(false);
        }
Beispiel #17
0
    private static IEnumerator ShowTitleImpl()
    {
        //加载Loading
        yield return(ShowLoading());

        //卸载场景
        yield return(StageBase.UnloadCurrentScene());

        yield return(Yielders.Frame);


        //显示主界面
        UIMainView.Show(true);

        yield return(new WaitForSeconds(0.2f));

        //关闭loading
        yield return(HideLoading());
    }
Beispiel #18
0
        public static ToListStage <T, TCache> Concat <T, TCache>(this StageBase <T, TCache> first, params StageBase <T, TCache>[]?rest)
            where TCache : class
        {
            if (first is null)
            {
                throw new ArgumentNullException(nameof(first));
            }
            var array = new StagePerformHandler <T, TCache> [(rest?.Length ?? 0) + 1];

            array[0] = first.DoIt;
            if (rest != null)
            {
                for (int i = 0; i < rest.Length; i++)
                {
                    array[i + 1] = rest[i].DoIt;
                }
            }

            return(new ToListStage <T, TCache>(first.Context, array));
        }
Beispiel #19
0
        private void Form1_Load(object sender, System.EventArgs e)
        {
            m_endogine = new EndogineHub(Application.ExecutablePath);

            string[] aAvailableStrategies = StageBase.GetAvailableRenderers(null);
//			string[] aAvailableStrategies = new string[]{Enum.GetName(typeof(EndogineHub.RenderStrategy), 0), Enum.GetName(typeof(EndogineHub.RenderStrategy), 1)};
            if (Endogine.AppSettings.Instance.GetNodeText("MDI") != "false")
            {
                this.IsMdiContainer = true;
            }

            if (Endogine.AppSettings.Instance.GetNodeText("SetupDialog") != "false")
            {
                SetupWindow wndSetup = new SetupWindow(aAvailableStrategies, this);
                wndSetup.ShowDialog();
            }

            m_formStage = new Main();

            Form formMdiParent = (Form)null;

            if (this.IsMdiContainer)
            {
                this.Width            = 800;
                this.Height           = 600;
                this.WindowState      = FormWindowState.Maximized;
                formMdiParent         = this;
                m_formStage.MdiParent = this;
            }
            else
            {
                this.Visible = false;                 //TODO: this doesn't work
                this.Text    = "Should be invisible!";
            }
            //TODO: anyhow, it's strange to use a Form to start from, the project should probably be a console application.

            m_formStage.Show();

            m_endogine.Init(m_formStage, formMdiParent, this);
            m_formStage.EndogineInitDone();
        }
Beispiel #20
0
        public void MakeNewHandler(JammerHuntStage newStage, bool scriptStart)
        {
            if (CurrentStageHandler != null)
            {
                CurrentStageHandler.Destroy(false);
                CurrentStageHandler = null;
            }

            switch (newStage)
            {
            case JammerHuntStage.Hunting:
                CurrentStageHandler = new HuntingStage();
                break;

            case JammerHuntStage.Complete:
                CurrentStageHandler = new CompleteStage();
                break;

            default:
                throw new NotImplementedException("Not implemented stage used with MakeNewHandler.");
            }

            CurrentStageHandler.Init(scriptStart);
        }
 //去除场景节奏事件
 public void deletStageRhythmEvent(StageBase stage)
 {
     curEmitter.isShootByRhythm    = false;
     stage.StageBulletRhythmEvent -= ShootImmediately;
 }
Beispiel #22
0
 void Start()
 {
     stage = GetComponent <StageBase>();
     InitializeDelegates();
     AddEvents();
 }
Beispiel #23
0
        public static RazorStage <T, TDocumentCache, TRenderCache> Razor <T, TDocumentCache, TRenderCache>(this StageBase <T, TDocumentCache> input, StageBase <RazorProvider, TRenderCache> renderer)
            where TDocumentCache : class
            where TRenderCache : class
        {
            if (input is null)
            {
                throw new ArgumentNullException(nameof(input));
            }
            if (renderer is null)
            {
                throw new ArgumentNullException(nameof(renderer));
            }

            if (!ReferenceEquals(input.Context, renderer.Context))
            {
                throw new ArgumentException("Both inputs must use the same Context");
            }

            return(new RazorStage <T, TDocumentCache, TRenderCache>(input.DoIt, renderer.DoIt, input.Context));
        }