示例#1
0
    public static void Save()
    {
        string path = XGamePath.GetLevelDataJsonPath(FileName);

        if (_ins == null)
        {
            _ins = new GameConfigData();
        }
        string json = JsonMapper.ToJson(_ins);

        try
        {
            if (File.Exists(path))
            {
                File.Delete(path);
            }
            byte[]     bytes = System.Text.Encoding.UTF8.GetBytes(json);
            FileStream fs    = File.Open(path, FileMode.CreateNew, FileAccess.Write);
            fs.Write(bytes, 0, bytes.Length);
            fs.Flush();
            fs.Close();
            Debuger.Log("GameConfig", "Save", string.Format("保存成功 路径={0},json={1}", path, json));
        }
        catch (Exception e)
        {
            Debuger.Log("GameConfig", "Save", e + "==>" + e.Data);
        }
    }
示例#2
0
 void LoadData()
 {
     GameData.Load();
     GameConfigData.Load();
     RecordData.Load();
     Debug.Log("加载数据完成");
 }
示例#3
0
    public void SaveGameData()
    {
        GameConfigData gameConfigData = GameDataManager.Instance.PeekData(DataType.GameConfigData) as GameConfigData;
        string         strData        = DataToString(gameConfigData);

        PlayerPrefs.SetString(GameDataKey, strData);
    }
示例#4
0
    public void LoadGamedata()
    {
        string strData = "";

        strData = PlayerPrefs.GetString(GameDataKey);
        GameConfigData gameConfigData = StringToData(strData);

        GameDataManager.Instance.ResetData(DataType.GameConfigData, gameConfigData);
    }
示例#5
0
    string DataToString(GameConfigData gameConfigData)
    {
        string strData = "";

        strData += "SoundActive:" + gameConfigData.SoundActive.ToString() + ";";
        strData += "MusicActive:" + gameConfigData.MusicActive.ToString() + ";";
        strData += "ShowOtherPlayerEffect:" + gameConfigData.ShowOtherPlayerEffect.ToString() + ";";
        strData += "ShowScenceEffect:" + gameConfigData.ShowScenceEffect.ToString() + ";";
        strData += "ShowEnemyName:" + gameConfigData.ShowEnemyName.ToString() + ";";
        return(strData);
    }
示例#6
0
    public void Init()
    {
        gameLevel        = new GameLevel();
        mapLocationDatas = new List <MapLocationData>();

        SpreadSheetGameConfig.OnUpdateGameConfigData.Subscribe(_ => {
            gameConfigData = _;
            Debug.Log("gameConfigData " + gameConfigData.photonNetworkConfig.gameVersion);
            Debug.Log("gameConfigData " + gameConfigData.photonNetworkConfig.sendRate);
        }).AddTo(this);
    }
示例#7
0
        public GamePreloaderViewModel(GamePreloaderView view, GamePreloader gamePreloader)
        {
            _view          = view;
            _gamePreloader = gamePreloader;

            GameConfigData configData = _gamePreloader.ConfigData;

            _serviceUrl      = configData.ServiceUrl;
            _endpointAddress = configData.EndpointAddress;
            AdUrl            = configData.AdUrl;
            IsFirst          = configData.IsFirstGo;
        }
示例#8
0
    public override void OnStateEnter(Animator animator, AnimatorStateInfo animatorStateInfo, int layerIndex)
    {
        _turn++;
        _eventAggregator = ServiceLocator.EventAggregator;
        _enemySpawner    = ServiceLocator.Instance.EnemySpawner;
        _stateMachine    = animator;
        _configData      = ServiceLocator.Instance.GameManager.GameConfigData;

        _spawnedEnemyCount = 0;
        _eventAggregator.Subscribe(this);
        _expectedEnemyCount = _configData.InitialEnemyAmount + _turn * _configData.IncrementInEnemyAmount;

        for (int i = 0; i < _expectedEnemyCount; i++)
        {
            _enemySpawner.SpawnEnemy();
        }
    }
示例#9
0
    public static void SerializerConfig()
    {
        GameConfigData gameConfigData = GameConfigDataBase.GetInstance().GetGameConfigData();

        if (gameConfigData == null)
        {
            Debug.Log("gameConfigData is null");
            return;
        }
        string detailGameConfigPath = string.Format("{0}/../conf/{1}", Application.dataPath, gameConfigData.detailGameConfigPath);
        string datPath = string.Format("{0}/../conf/{1}", Application.dataPath, gameConfigData.datPath);

        GetTargetDirAllFilePath(datPath);

        FunPlus.Util.CheckXML.GetInstance().LoadIgnoreFile();

        GameConfigGroups gameXmlGroups;
        GameConfigGroups gameXmlSheetGroups;

        //GameConfigGroups gameXmlLevelGroups;
        //GameConfigDataBase.GetInstance().TryGetGroups(out gameXmlGroups, out gameXmlSheetGroups, out gameXmlLevelGroups);
        GameConfigDataBase.GetInstance().TryGetGroups(out gameXmlGroups, out gameXmlSheetGroups);
        GetAllFileByXmlGroup(gameXmlGroups);
        SerializeAllXml(mXmlGroups);

        //GetAllFileByXmlLevelGroup(gameXmlLevelGroups);
        //SerializeAllXml(mXmlLevelGroups);

        GetAllFileBySheetGroup(gameXmlSheetGroups);
        SerializeAllXmlSheet(mXmlSheetGroups);

        ConfigGroupsSettings conf = new ConfigGroupsSettings();

        conf.xmlGroups      = mXmlGroups.ToArray();
        conf.xmlSheetGroups = mXmlSheetGroups.ToArray();
        conf.xmlLevelGroups = mXmlLevelGroups.ToArray();
        //删除这次生成之外的文件
        DeleteNotChangePath(conf);

        ReplaceRelativePath(ref conf);
        GameConfigDataBase.GetInstance().DetailPathWriteToFile <ConfigGroupsSettings>(conf, detailGameConfigPath);
    }
示例#10
0
    private static void Init()
    {
        string path = XGamePath.GetLevelDataJsonPath(FileName);

        if (File.Exists(path))
        {
            try
            {
                StreamReader fs   = File.OpenText(path);
                string       json = fs.ReadToEnd();
                fs.Close();
                _ins = JsonMapper.ToObject <GameConfigData>(json);
            }
            catch (Exception e)
            {
                Debuger.Log("GameConfig", "load", e + "==>" + e.Data);
            }
        }
        else
        {
            Debuger.Log("GameConfig", "load", "file not exist");
        }
    }
示例#11
0
 GameConfigData StringToData(string str)
 {
     if (string.IsNullOrEmpty(str))
     {
         return(new GameConfigData());
     }
     else
     {
         GameConfigData            gameConfigData = new GameConfigData();
         string[]                  StrChild       = str.Split(';');
         Dictionary <string, bool> dataConfig     = new Dictionary <string, bool>();
         foreach (var child in StrChild)
         {
             string[] childData = child.Split(':');
             dataConfig.Add(childData[0], bool.Parse(childData[1]));
         }
         gameConfigData.SoundActive           = dataConfig["SoundActive"];
         gameConfigData.MusicActive           = dataConfig["MusicActive"];
         gameConfigData.ShowOtherPlayerEffect = dataConfig["ShowOtherPlayerEffect"];
         gameConfigData.ShowScenceEffect      = dataConfig["ShowScenceEffect"];
         gameConfigData.ShowEnemyName         = dataConfig["ShowEnemyName"];
         return(gameConfigData);
     }
 }
示例#12
0
        public void LoadXD()
        {
            this.checksum = new uint[4];
            this.substructureSizes = new ushort[16];
            this.substructureOffsets = new uint[16];
            this.flagDataSubSizes = new ushort[5];
            this.unhandledSubstructures = new byte[16][];
            this.randomBytes = new byte[40];

            ushort[] checksum_tmp = new ushort[8];
            for (int i = 0; i < 8; i++)
                checksum_tmp[8 - i - 1] = BigEndian.ToUInt16(raw, 0x10 + i * 2);
            for (int i = 0; i < 4; i++)
                checksum[i] = ((uint)checksum_tmp[i * 2] << 16) | (uint)checksum_tmp[i * 2 + 1];

            ushort[] substructureOffsetsTmp = new ushort[32];
            BigEndian.LoadArray(substructureSizes, raw, 0x20);
            BigEndian.LoadArray(substructureOffsetsTmp, raw, 0x40);
            BigEndian.LoadArray(flagDataSubSizes, raw, 0x80);
            flagDataSubSizes[4] = raw[0x8A];

            //int start = 8 + 0xA0;
            for (int i = 0; i < 16; i++)
                substructureOffsets[i] = (uint)(((uint)substructureOffsetsTmp[2 * i + 1] << 16) | (uint)substructureOffsetsTmp[2 * i]);

            otherCorruptionFlags = substructureSizes[0] != 0x88;
            for (int i = 0; i < 16; i++) {
                //if (i == 1 || i == 2)
                //	unhandledSubstructures[i] = null;
                //else
                    unhandledSubstructures[i] = LoadSubstructure(raw, substructureOffsets[i], substructureSizes[i], SubstructureMaxSizes[i]);
            }

            int id = 0;
            this.gameConfigData = new GameConfigData(gameSave, LoadSubstructure(raw, substructureOffsets[id], substructureSizes[id], SubstructureMaxSizes[id]), this);
            id = 1;
            this.playerData = new PlayerData(gameSave, LoadSubstructure(raw, substructureOffsets[id], substructureSizes[id], SubstructureMaxSizes[id]), this);
            id = 2;
            this.pcData = new PCData(gameSave, LoadSubstructure(raw, substructureOffsets[id], substructureSizes[id], SubstructureMaxSizes[id]), this);
            id = 4;
            this.daycareData = new DaycareData(gameSave, LoadSubstructure(raw, substructureOffsets[id], substructureSizes[id], SubstructureMaxSizes[id]), this);
            id = 5;
            this.memoData = new StrategyMemoData(gameSave, LoadSubstructure(raw, substructureOffsets[id], substructureSizes[id], SubstructureMaxSizes[id]), this);
            id = 7;
            this.shadowData = new ShadowPokemonData(gameSave, LoadSubstructure(raw, substructureOffsets[id], substructureSizes[id], SubstructureMaxSizes[id]), this);
            id = 14;
            this.purifierData = new PurifierData(gameSave, LoadSubstructure(raw, substructureOffsets[id], substructureSizes[id], SubstructureMaxSizes[id]), this);
            { // Flags
                ushort size = 0;
                for (int i = 0; i < 5; i++)
                    size += flagDataSubSizes[i];
                if (size <= SubstructureMaxSizes[8])
                    ByteHelper.ReplaceBytes(unhandledSubstructures[8], size, new byte[SubstructureMaxSizes[8] - size]);
            }
            for (int i = 0; i < 16; i++)
                substructureSizes[i] = SubstructureMaxSizes[i];

            ByteHelper.ReplaceBytes(randomBytes, 0, ByteHelper.SubByteArray(raw.Length - 40, raw, 40));
        }
示例#13
0
 public void LoadColosseum()
 {
     this.gameConfigData = new GameConfigData(gameSave, ByteHelper.SubByteArray(8, raw, 112), this);
     this.playerData = new PlayerData(gameSave, ByteHelper.SubByteArray(120, raw, 2840), this);
     this.pcData = new PCData(gameSave, ByteHelper.SubByteArray(2960, raw, 29080), this);
     this.daycareData = new DaycareData(gameSave, ByteHelper.SubByteArray(33136, raw, 0x140), this);
     this.memoData = new StrategyMemoData(gameSave, ByteHelper.SubByteArray(33456, raw, 6004), this);
     //Mailbox 32040 + 1096 = 33136
     //BattleMode 58344
     //RibbonDescriptions 115804
     this.randomBytes = new byte[20];
     ByteHelper.ReplaceBytes(randomBytes, 0, ByteHelper.SubByteArray(0x1dfd8, raw, 20));
 }
示例#14
0
 /// <summary>
 /// 关闭界面时调用
 /// </summary>
 /// <param name="objs"></param>
 public override void OnClose(params object[] objs)
 {
     base.OnClose(objs);
     GameConfigData.Save();
 }
示例#15
0
 // Use this for initialization
 void Start()
 {
     // Instantiate board
     InitializeDefaults();
     InstantiateBoard ();
     InstantiatePieces();
     ClearMoves();
     PlayerTurn = 1;
     MoveInProgress = false;
     GameConfig = GameObject.Find("GameConfigData").GetComponent<GameConfigData>();
 }