Beispiel #1
0
        void UpdateSceneChange()
        {
            bool pInGame = inGame;

            inGame = GameObject.Find("_CanvasGame_New") != null;

            MethodInfo initPlayerf = typeof(Item).GetMethod("InitPlayer", BindingFlags.NonPublic | BindingFlags.Instance);

            if (!pInGame && inGame)
            {
                foreach (RaftMod mod in RaftMod.Get())
                {
                    foreach (Item item in mod.GetItems())
                    {
                        initPlayerf.Invoke(item, new object[] { PlayerHelper.GetPlayer("") });
                    }
                }
            }

            foreach (ISceneListener sceneListener in RaftMod.GetInterfaces <ISceneListener>())
            {
                SceneUpdateType sceneUpdate = SceneUpdateType.Game_join;

                if (!pInGame && inGame)
                {
                    sceneListener.OnGameJoin();
                }
                else if (pInGame && !inGame)
                {
                    sceneListener.OnGameLeave();
                    sceneUpdate = SceneUpdateType.Game_leave;
                }
                else if (pInGame && inGame)
                {
                    sceneListener.OnGameChange();
                    sceneUpdate = SceneUpdateType.Game_change;
                }
                else if (!pInGame && !inGame)
                {
                    sceneListener.OnMenuChange();
                    sceneUpdate = SceneUpdateType.Menu_change;
                }

                sceneListener.OnSceneUpdate(sceneUpdate);
            }
        }
Beispiel #2
0
 public void OnSceneUpdate(SceneUpdateType type)
 {
 }