Example #1
0
        public static void SaveSceneMeta(string sceneName, SceneMeta sceneMeta)
        {
            Directory.CreateDirectory(Paths.Getter().SceneFolder());
            var sceneMetaSerialize = JsonConvert.SerializeObject(sceneMeta);

            File.WriteAllText(GetSceneFilePath(sceneName), sceneMetaSerialize, Encoding.UTF8);
        }
Example #2
0
        public void GoToNextLevelPressed()
        {
            var sceneMeta = new SceneMeta();

            sceneMeta.PutField("show_unlocking_animation", true);

            Finder.FindMandatory <SceneSwitcher>().SwitchToScene("LevelMenu", sceneMeta);
        }
Example #3
0
 private void LoadScene(SceneMeta meta)
 {
     foreach (var mmdObjectMeta in meta.MmdObjects)
     {
         if (string.IsNullOrEmpty(mmdObjectMeta.ModelPath))
         {
             continue;
         }
         try
         {
             AddModel(Paths.RelativeToHomePath(mmdObjectMeta.ModelPath));
             var modelTransform = GetCurrentModelTransform();
             modelTransform.localPosition = UnityUtils.ListToVector3(mmdObjectMeta.Position);
             modelTransform.localRotation = UnityUtils.ListToQuaternion(mmdObjectMeta.Rotation);
         }
         catch (Exception e)
         {
             Debug.LogException(e);
             continue;
         }
         if (!string.IsNullOrEmpty(mmdObjectMeta.MotionPath))
         {
             try
             {
                 ChangeCurrentMotion(Paths.RelativeToHomePath(mmdObjectMeta.MotionPath));
             }
             catch (Exception e)
             {
                 Debug.LogException(e);
             }
         }
         if (!string.IsNullOrEmpty(mmdObjectMeta.BonePosePath))
         {
             try
             {
                 ChangeCurrentBonePoseFile(Paths.RelativeToHomePath(mmdObjectMeta.BonePosePath));
             }
             catch (Exception e)
             {
                 Debug.LogException(e);
             }
         }
     }
     if (!string.IsNullOrEmpty(meta.MusicPath))
     {
         ChangeMusic(Paths.RelativeToHomePath(meta.MusicPath));
     }
     CameraFilePath = meta.CameraPath;
     if (_currentXrController.GetType() == XrType.CameraFile)
     {
         var cameraFileController = _currentXrController as CameraFileController;
         if (cameraFileController != null)
         {
             cameraFileController.CameraObject.LoadCameraMotion(Paths.RelativeToHomePath(CameraFilePath));
         }
     }
 }
Example #4
0
        protected override void LoadMeta(SceneMeta meta)
        {
            if (meta == null)
            {
                return;
            }

            _levelIndex = meta.GetField <int>("level_index");
        }
        protected override void LoadMeta(SceneMeta meta)
        {
            if (meta == null)
            {
                return;
            }

            _testMode = meta.GetFieldOrDefault <bool>("test_mode") is true;
            _showUnlockingAnimation = meta.GetFieldOrDefault <bool>("show_unlocking_animation") is true;
        }
Example #6
0
        private static void OpenLevelMenu(bool testMode)
        {
            try
            {
                var meta = new SceneMeta();
                meta.PutField("test_mode", testMode);

                Finder.FindMandatory <SceneSwitcher>().SwitchToScene("LevelMenu", meta);
            }
            catch (Finder.MandatoryObjectNotFound)
            {
                Debug.LogError("Can't find scene switcher!");
            }
        }
Example #7
0
        private SceneMeta GetSceneMeta()
        {
            var ret = new SceneMeta {
                MusicPath = _musicPath, CameraPath = CameraFilePath
            };
            var objectMetas = (from mmdObject in _mmdObjects
                               let mmdGameObject = mmdObject.GetComponent <MmdGameObject>()
                                                   select new MmdObjectMeta
            {
                ModelPath = mmdGameObject.ModelPath,
                MotionPath = mmdGameObject.MotionPath,
                BonePosePath = mmdGameObject.BonePoseFilePath,
                Position = UnityUtils.Vector3ToList(mmdObject.transform.localPosition),
                Rotation = UnityUtils.QuaternionToList(mmdObject.transform.localRotation)
            }).ToList();

            ret.MmdObjects = objectMetas;
            return(ret);
        }
Example #8
0
    public IEnumerator WaitTrigger(float wait)
    {
        int roll = Random.Range(0, 10);

        if (roll < 1 && GetComponent <Move>().Moving() && !PauseManager.instance.IsOpen() && !DialogManager.instance.ShopActive() && !DialogManager.instance.DialogActive())
        {
            Debug.Log("Hit");

            //GetComponent<Move>().disableMove();
            AdventureMeta meta      = BaseSaver.getAdventure();
            Glossary      glossy    = GameObject.Find("PauseCanvas").GetComponent <PauseManager>().glossaryObj.GetComponent <Glossary>();
            SceneMeta     thisScene = glossy.GetScene(BaseSaver.getMap()).meta;

            List <PlayerRosterMeta> monsters = new List <PlayerRosterMeta>();
            foreach (string mons in thisScene.monsters)
            {
                if (!mons.Equals(lastMonster))
                {
                    MonsterMeta met = glossy.GetMonsterMain(mons).meta;
                    int         lvl = Random.Range(thisScene.monsterLvls[0], thisScene.monsterLvls[1]);
                    monsters.Add(MonsterMeta.returnMonster(met, lvl, true));
                }
            }

            PlayerRosterMeta[] scrbMons = monsters.ToArray();
            GameUtilities.ShuffleArray(scrbMons);

            meta.trainer            = null;
            meta.wild               = scrbMons[0];
            meta.isTrainerEncounter = false;
            lastMonster             = meta.wild.name;

            BaseSaver.putAdventure(meta);
            BaseSaver.putBoard(GameUtilities.getBoardState(BaseSaver.getMap(), new PosMeta(transform.position)));

            StartCoroutine(DialogManager.FightFlash(false));
            //Initiate.Fade("BejeweledScene", Color.black, 1.0f);
        }
        yield return(new WaitForSeconds(wait));

        waitingForRoll = false;
        yield return(null);
    }
Example #9
0
        public void OpenLevel()
        {
            if (!enabled)
            {
                return;
            }

            try
            {
                var sceneSwitcher = Finder.FindMandatory <SceneSwitcher>();
                var sceneMeta     = new SceneMeta();

                sceneMeta.PutField("level_index", _levelIndex);
                sceneMeta.PutField("figure_prefab", _figurePrefab);

                sceneSwitcher.SwitchToScene("Level", sceneMeta);
            }
            catch (Finder.MandatoryObjectNotFound)
            {
                Debug.LogError("Scene switcher not found");
            }
        }
Example #10
0
 private void ReloadScene(SceneMeta meta)
 {
     ClearScene();
     LoadScene(meta);
 }
Example #11
0
 void Start()
 {
     singleton = this;
 }