123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- using System;
- using System.Collections.Generic;
- using System.IO;
- using UnityEngine;
- public static class GameModeManager
- {
- public static GameModeManager.Data GetData(GameModeManager.Type gameMode)
- {
- NDebug.Assert(GameModeManager.DataDic.ContainsKey(gameMode), "ゲームの進行モードに不正な値が入りました");
- return GameModeManager.DataDic[gameMode];
- }
- public static GameModeManager.Data GetData()
- {
- return GameModeManager.GetData(GameModeManager.nowGameMode);
- }
- public static GameModeManager.Type nowGameMode
- {
- get
- {
- return GameModeManager.m_NowGameModeType;
- }
- set
- {
- GameModeManager.m_NowGameModeType = value;
- }
- }
- public static bool Serialize(BinaryWriter brWrite)
- {
- brWrite.Write("CM3D21_GAME_MODE_MGR");
- brWrite.Write(1350);
- brWrite.Write(1);
- brWrite.Write((int)GameModeManager.m_NowGameModeType);
- return true;
- }
- public static bool Deserialize(BinaryReader brRead)
- {
- GameModeManager.Reset();
- if (brRead.BaseStream.Length <= brRead.BaseStream.Position + 1L)
- {
- Debug.Log("GameModeManager\nこれ以上は読めない");
- return false;
- }
- long position = brRead.BaseStream.Position;
- string text = brRead.ReadString();
- if (text != "CM3D21_GAME_MODE_MGR")
- {
- Debug.Log("GameModeManager\nヘッダー取得に失敗しました。\n" + text);
- brRead.BaseStream.Seek(position, SeekOrigin.Begin);
- return false;
- }
- int num = brRead.ReadInt32();
- position = brRead.BaseStream.Position;
- int num2 = brRead.ReadInt32();
- int value = brRead.ReadInt32();
- try
- {
- GameModeManager.nowGameMode = (GameModeManager.Type)Enum.ToObject(typeof(GameModeManager.Type), value);
- }
- catch (Exception e)
- {
- NDebug.AssertParseError("GameModeManager.Type", e);
- }
- return true;
- }
- private static void Reset()
- {
- GameModeManager.nowGameMode = GameModeManager.Type.Normal;
- }
- public static readonly Dictionary<GameModeManager.Type, GameModeManager.Data> DataDic = new Dictionary<GameModeManager.Type, GameModeManager.Data>
- {
- {
- GameModeManager.Type.Normal,
- new GameModeManager.Data(GameModeManager.Type.Normal, "main_banner_um", "従来のモード\nメイドのスケジュールを設定することで、仕事、育成、夜伽を行う事のできる従来のモード\u3000")
- },
- {
- GameModeManager.Type.LifeMode,
- new GameModeManager.Data(GameModeManager.Type.LifeMode, "main_banner_elm", "ライフモード\nメイド達が普段どのような風に\n生活、仕事をしているのかを見ることが出来るモード\n普段は見ることのできない一面や、メイド同士の珍しいやり取りが見れるかも?")
- }
- };
- private static GameModeManager.Type m_NowGameModeType;
- private const string STR_LOG_HEAD = "GameModeManager\n";
- private const string STR_GAME_MODE_SERIALIZE_HEADER = "CM3D21_GAME_MODE_MGR";
- private const int GAME_MODE_SERIALIZE_VER = 1;
- public enum Type
- {
- Normal,
- LifeMode
- }
- public class Data
- {
- public Data(GameModeManager.Type mode, string strBannerImageName, string strDescription)
- {
- this.strBannerImageName = strBannerImageName;
- this.strDescription = strDescription;
- }
- public readonly GameModeManager.Type gameMode;
- public readonly string strBannerImageName;
- public readonly string strDescription;
- }
- }
|