Beispiel #1
0
    /// <summary>次のシーンを読み込む</summary>
    public void ChangeScene(SceneDefinition next_scene)
    {
        bool is_load_ok = false;

        if (null == prefab_loader)//以下null対策
        {
            prefab_loader = new PrefabLoader();
            is_load_ok    = true;
        }
        if (null == bgm_data_loader)
        {
            bgm_data_loader = new BgmDataLoader();
            is_load_ok      = true;
        }
        if (null == se_data_loader)
        {
            se_data_loader = new SeDataLoader();
            is_load_ok     = true;
        }

        if (is_load_ok)
        {
            Init();
        }
        else
        {
            Ready();
        }
        prefab_loader.LoadResource(next_scene);
        bgm_data_loader.LoadResource(next_scene);
        se_data_loader.LoadResource(next_scene);
    }
Beispiel #2
0
 /// <summary>シーンに合わせたリソースのパスを取得</summary>
 public static string[] GetResoucePaths(SceneDefinition scene_name)
 {
     if (scene_resource_path.ContainsKey(scene_name))
     {
         return(scene_resource_path[scene_name]);
     }
     return(new string[] { "" });
 }
Beispiel #3
0
 /// <summary>シーンに合わせたリソースのパスを取得</summary>
 public static string[] GetResoucePaths(SceneDefinition _define)
 {
     if (scene_resource_path_dic.ContainsKey(_define))
     {
         return(scene_resource_path_dic[_define]);
     }
     return(new string[] { "" });
 }
Beispiel #4
0
 public TTS(SceneDefinition sceneDefinition, List <CharacterDefinition> characterDefinitions, List <ObjectDefinition> objectDefinitions, List <DataDefinition> dataDefinitions, List <Instruction> instructions)
 {
     this.SceneDefinition      = sceneDefinition;
     this.CharacterDefinitions = characterDefinitions;
     this.ObjectDefinitions    = objectDefinitions;
     this.DataDefinitions      = dataDefinitions;
     this.Instructions         = instructions;
 }
Beispiel #5
0
 private void change_scene(SceneDefinition _scene)
 {
     ResourceManager.Instance.CallLoadEndSubject.Subscribe((x) =>
     {
         Debug.Util.Log("[To Play] All load is Complete");
         SceneManager.LoadScene(SceneTransition.Instance.get_scene_name(_scene));
     }).AddTo(this);
     SceneTransition.Instance.ChangeScene(_scene);
 }
 public void SetScenesFromManifest(Manifest manifest)
 {
     sceneDefinitions.Clear();
     ScriptableObject[] assets = manifest.Assets;
     for (int i = 0; i < assets.Length; i++)
     {
         SceneDefinition sceneDefinition = (SceneDefinition)assets[i];
         sceneDefinitions.Add(sceneDefinition.SceneName, sceneDefinition);
     }
 }
Beispiel #7
0
 private void set_change_scene_ready(SceneDefinition _scene)
 {
     ResourceManager.Instance.CallLoadEndSubject.Subscribe((x) =>
     {
         Debug.Util.Log("[To Result] All load is Complete");
         UnitManagerSystem.Instance.ResetEnemyList();
         SceneManager.LoadScene(SceneTransition.Instance.get_scene_name(_scene));
     }).AddTo(this);
     SceneTransition.Instance.ChangeScene(_scene);
 }
Beispiel #8
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            _entityManager = new EntityManager(GraphicsDevice);

            _sceneManager = new SceneManager(Services, Content, _entityManager);

            Services.AddService <ISceneManager>(_sceneManager);

            // TODO: use this.Content to load your game content here
            Texture2D idleTexture      = Content.Load <Texture2D>("Textures/main-hero_idle-unarmed");
            Texture2D idleArmedTexture = Content.Load <Texture2D>("Textures/main-hero_idle-armed");
            Texture2D walkTexture      = Content.Load <Texture2D>("Textures/main-hero_walk-unarmed");
            Texture2D walkArmedTexture = Content.Load <Texture2D>("Textures/main-hero_walk-armed");
            Texture2D attackTexture    = Content.Load <Texture2D>("Textures/main-hero_attack-sword");

            PlayerTextureContainer container = new PlayerTextureContainer
            {
                Idle      = idleTexture,
                IdleArmed = idleArmedTexture,
                Walk      = walkTexture,
                WalkArmed = walkArmedTexture,
                Attack    = attackTexture
            };

            _player = new Player(this, container, LoadPlayerAttackSounds())
            {
                Position = new Vector2(150, 100)
            };
            _playerController = new PlayerController(_player);

            _debugTexture = new Texture2D(GraphicsDevice, 1, 1);
            _debugTexture.SetData(new[] { Color.White });

            TileSet testTileSet = Content.Load <TileSet>("Test");

            testTileSet.LoadTexture(Content);

            TileMap testMap = Content.Load <TileMap>("TileMaps/Ninja_TestMap");

            testMap.LoadTileSets(Content);

            SceneDefinition testSceneDef = new SceneDefinition
            {
                Name        = "TestScene",
                SceneId     = "TestScene",
                TileMapPath = "TileMaps/Ninja_TestMap"
            };

            _sceneManager.AddSceneDefinition(testSceneDef);
            _sceneManager.LoadScene("TestScene");
        }
Beispiel #9
0
        void Start()
        {
#if UNITY_EDITOR
            // In the editor we load any previous scene definition.
            SceneDefinition previousEditorSceneDefinition = EditorUtility.InstanceIDToObject(EditorPrefs.GetInt(EditorSceneManager_Loader.previousSceneDefinitionKey)) as SceneDefinition;
            if (previousEditorSceneDefinition != null)
            {
                ServiceLocator.SceneService.LoadScene(previousEditorSceneDefinition);
                return;
            }
#endif

            ServiceLocator.SceneService.LoadScene(nextScene);
        }
 private static string[] getCurrentAdditiveScenes(SceneDefinition sceneDefinition)
 {
     for (int i = 0; i < sceneDefinition.AdditiveSceneOverrides.Length; i++)
     {
         AdditiveSceneOverride additiveSceneOverride = sceneDefinition.AdditiveSceneOverrides[i];
         if (Service.Get <ContentSchedulerService>().IsDuringScheduleEventDates(additiveSceneOverride.DateDefinitionKey))
         {
             return(additiveSceneOverride.AdditiveScenes);
         }
         if (!string.IsNullOrEmpty(additiveSceneOverride.PlayerPrefsKey) && DisplayNamePlayerPrefs.HasKey(additiveSceneOverride.PlayerPrefsKey))
         {
             return(additiveSceneOverride.AdditiveScenes);
         }
     }
     return(sceneDefinition.AdditiveScenes);
 }
Beispiel #11
0
        public void Awake()
        {
            scene_trans = this;
            Debug.Util.Log("[SceneTransition] Instance is get Ready");
            DontDestroyOnLoad(this);
            resouce_manager = ResourceManager.CreateInstance();
            Debug.Util.Log("--- Resource Loaded");

            sound_controller = SoundController.CreateInstance();
            sound_controller.setDataLoader(resouce_manager.Bgm, resouce_manager.Se);
            Debug.Util.Log("--- Sound Loaded : " + sound_controller.ToString());

            next_scene = SceneDefinition.Menu;
            ChangeScene(next_scene);
            Debug.Util.Log("--- Scene Changed");
        }
Beispiel #12
0
 /// <summary>シーン名取得</summary>
 public string get_scene_name(SceneDefinition _scene_type)
 {
     switch (next_scene)
     {
         case SceneDefinition.Initalize:
             return "Initialize";
         case SceneDefinition.Menu:
             return "Menu";
         case SceneDefinition.Play:
             return "Play";
         case SceneDefinition.Ranking:
             return "Ranking";
         case SceneDefinition.Result:
             return "Result";
     }
     return "undefined_scene";
 }
Beispiel #13
0
        /// <summary>シーン読み込みの進捗確認</summary>
        private IEnumerator load_scene_progress()
        {
            var _proggress = SceneManager.LoadSceneAsync(get_scene_name(next_scene));
            while (false == _proggress.isDone)
            {
                yield return null;
            }

            int _safe_debug_count = 0;// 無限ループを防止する
            while (false == ResourceManager.Instance.IsComplete)
            {
                _safe_debug_count++;
                if (_safe_debug_count > 1000) { break; }
                yield return null;
            }

            SceneManager.UnloadSceneAsync(get_scene_name(now_scene));
            now_scene = next_scene;
            yield break;
        }
Beispiel #14
0
 public void LoadResource(SceneDefinition _next_scene)
 {
     next_scene_load = _next_scene;
     UnLoadResouces(already_loaded_scene);
     Observable.FromCoroutine(load_resources).Subscribe();
 }
Beispiel #15
0
 /// <summary>遷移実行</summary>
 public void ChangeScene(SceneDefinition _next_scene)
 {
     next_scene = _next_scene;
     Debug.Util.LogFormat("Scene {0} is called", _next_scene.ToString());
     ResourceManager.Instance.ChangeScene(next_scene);
 }
Beispiel #16
0
 protected abstract string[] get_resouce_path(SceneDefinition _next_scene);
Beispiel #17
0
 public Link(SceneDefinition destination, SceneDefReference origin)
 {
     this.Destination = destination;
     this.Origin      = origin;
 }
 private IEnumerator loadPrerequisiteContent(SceneDefinition sceneDefinition)
 {
     yield return(Service.Get <ScenePrereqContentManager>().LoadPrereqBundlesForScene(sceneDefinition.SceneName));
 }
Beispiel #19
0
 protected override string[] get_resouce_path(SceneDefinition _next_scene)
 {
     return(SePath.GetResoucePaths(_next_scene));
 }
Beispiel #20
0
        public TTS(Stream stream)
        {
            using (BinaryReader reader = new BinaryReader(stream, Encoding.UTF8, true)) {
                long ttsStartOffset = reader.BaseStream.Position;

                this.SceneDefinition = new SceneDefinition((Location)reader.ReadByte(), (Time)reader.ReadByte(), (Music)reader.ReadByte());

                byte numChars          = reader.ReadByte();
                byte numObjs           = reader.ReadByte();
                byte numCharAnimations = reader.ReadByte();
                byte numCharEmotions   = reader.ReadByte();
                byte numDialogueBoxes  = reader.ReadByte();
                byte numVoiceClips     = reader.ReadByte();
                byte numPopups         = reader.ReadByte();
                byte numSoundEffects   = reader.ReadByte();
                reader.ReadByte(); // Padding
                ushort numInstrs      = reader.ReadUInt16();
                byte   numDataObjects = reader.ReadByte();
                byte   numTutorials   = reader.ReadByte();

                this.CharacterDefinitions = new List <CharacterDefinition>();
                for (int i = 0; i < numChars; i++)
                {
                    this.CharacterDefinitions.Add(new CharacterDefinition((Character)reader.ReadByte(), (Outfit)reader.ReadByte(), reader.ReadByte(), reader.ReadByte()));
                }

                this.ObjectDefinitions = new List <ObjectDefinition>();
                for (int i = 0; i < numObjs; i++)
                {
                    this.ObjectDefinitions.Add(new ObjectDefinition((ObjectType)reader.ReadByte(), reader.ReadByte(), reader.ReadByte(), reader.ReadByte()));
                }

                // We don't need these index lists, as they're always the same or reference raw IDs.
                reader.BaseStream.Seek(numCharAnimations * 4
                                       + numCharEmotions * 4
                                       + numDialogueBoxes * 4
                                       + numVoiceClips * 4
                                       + numPopups * 4
                                       + numSoundEffects * 4
                                       + numTutorials * 4,
                                       SeekOrigin.Current);

                this.DataDefinitions = new List <DataDefinition>();
                for (int i = 0; i < numDataObjects; i++)
                {
                    uint     offset = reader.ReadUInt32();
                    uint     size   = reader.ReadUInt32();
                    DataType type   = (DataType)reader.ReadUInt32();

                    long pos = reader.BaseStream.Position;
                    reader.BaseStream.Seek(ttsStartOffset + offset, SeekOrigin.Begin);

                    object value;
                    switch (type)
                    {
                    case DataType.GBIX:
                        value = new GBIX(reader.BaseStream);
                        break;

                    default:
                        value = reader.ReadBytes((int)size);
                        break;
                    }

                    this.DataDefinitions.Add(new DataDefinition(type, value));

                    reader.BaseStream.Seek(pos, SeekOrigin.Begin);
                }

                this.Instructions = new List <Instruction>();
                for (int i = 0; i < numInstrs; i++)
                {
                    byte opcode = reader.ReadByte();
                    switch (opcode)
                    {
                    case 0x00:
                        this.Instructions.Add(new NopInstruction());
                        break;

                    case 0x02:
                        this.Instructions.Add(new SetUsernameInstruction());
                        break;

                    case 0x03:
                        this.Instructions.Add(new EndSceneInstruction());
                        break;

                    case 0x07:
                        this.Instructions.Add(new OverlayCreditsInstruction(reader.ReadByte(), reader.ReadUInt16()));
                        break;

                    case 0x08:
                        this.Instructions.Add(new LocationChangeInstruction((Location)reader.ReadByte(), (Time)reader.ReadByte()));
                        break;

                    case 0x09:
                        this.Instructions.Add(new CharacterReplaceOutfitsInstruction((Outfit)reader.ReadByte(), (Outfit)reader.ReadByte()));
                        break;

                    case 0x0D:
                        this.Instructions.Add(new ControlTutorialInstruction((TutorialAction)reader.ReadByte()));
                        break;

                    case 0x0E:
                        this.Instructions.Add(new ShowTutorialInstruction((Tutorial)reader.ReadByte()));
                        break;

                    case 0x0F:
                        this.Instructions.Add(new CharacterInstrumentInstruction((Character)reader.ReadByte(), reader.ReadBoolean()));
                        break;

                    case 0x11:
                        this.Instructions.Add(new LocationSetInstruction((Location)reader.ReadByte(), (Time)reader.ReadByte()));
                        break;

                    case 0x12:
                        this.Instructions.Add(new ControlSceneVisibilityInstruction(reader.ReadBoolean()));
                        break;

                    case 0x13:
                        this.Instructions.Add(new CharacterSetInstruction((Character)reader.ReadByte(), (Outfit)reader.ReadByte(), reader.ReadByte(), reader.ReadByte()));
                        break;

                    case 0x14:
                        this.Instructions.Add(new CharacterAnimationInstruction((Character)reader.ReadByte(), (CharacterAnimation)reader.ReadByte(), reader.ReadUInt16() != 0));
                        break;

                    case 0x15:
                        this.Instructions.Add(new CharacterFaceInstruction((Character)reader.ReadByte(), (CharacterFace)reader.ReadByte()));
                        break;

                    case 0x16:
                        this.Instructions.Add(new CharacterEmotionInstruction((Character)reader.ReadByte(), (CharacterEmotion)reader.ReadByte(), reader.ReadUInt16()));
                        break;

                    case 0x17:
                        this.Instructions.Add(new CharacterMoveInstruction((Character)reader.ReadByte(), reader.ReadByte(), reader.ReadUInt16(), reader.ReadUInt16()));
                        break;

                    case 0x18:
                        this.Instructions.Add(new CharacterRotateInstruction((Character)reader.ReadByte(), reader.ReadUInt16(), reader.ReadUInt16()));
                        break;

                    case 0x1A:
                        this.Instructions.Add(new CharacterLookAtInstruction((Character)reader.ReadByte(), (Character)reader.ReadByte(), reader.ReadUInt16()));
                        break;

                    case 0x1B:
                        this.Instructions.Add(new CharacterHoldObjectInstruction((Character)reader.ReadByte(), reader.ReadBoolean(), (ObjectType)reader.ReadByte()));
                        break;

                    case 0x1C:
                        this.Instructions.Add(new ObjectSetInstruction((ObjectType)reader.ReadByte(), reader.ReadByte(), reader.ReadByte(), reader.ReadByte()));
                        break;

                    case 0x1D:
                        this.Instructions.Add(new ControlDoorsInstruction(reader.ReadBoolean()));
                        break;

                    case 0x1E:
                        this.Instructions.Add(new ObjectRotationInstruction(reader.ReadByte(), reader.ReadUInt16()));
                        break;

                    case 0x1F:
                        this.Instructions.Add(new ObjectPositionInstruction(reader.ReadByte(), reader.ReadByte(), reader.ReadByte()));
                        break;

                    case 0x20:
                        this.Instructions.Add(new SleepInstruction(reader.ReadUInt16()));
                        break;

                    case 0x21:
                        this.Instructions.Add(new ControlMusicInstruction((MusicOperation)reader.ReadByte(), (Music)reader.ReadByte(), reader.ReadUInt16()));
                        break;

                    case 0x22:
                        this.Instructions.Add(new PlaySoundEffectInstruction(reader.ReadByte()));
                        break;

                    case 0x23:
                        this.Instructions.Add(new ControlPictureOverlayInstruction((Picture)reader.ReadByte(), (PictureOverlayAction)reader.ReadByte()));
                        break;

                    case 0x24:
                        this.Instructions.Add(new CharacterSpeakInstruction(reader.ReadByte(), (BubbleType)reader.ReadByte()));
                        break;

                    case 0x26:
                        this.Instructions.Add(new ShowPopupInstruction((Popup)reader.ReadByte()));
                        break;

                    default:
                        throw new Exception("Unknown opcode 0x" + opcode.ToString("X") + " at 0x" + (reader.BaseStream.Position - 1).ToString("X"));
                    }
                }
            }
        }
Beispiel #21
0
 protected void UnLoadResouces(SceneDefinition _now_scene)
 {
     resource_data_dic.Clear();
 }