示例#1
0
 public static EventControlDataMap GetEventControlDataMap()
 {
     EventControlDataMap fileDataMap = new EventControlDataMap();
     ResourceManager.DecodePersonalDataTemplate(GetEventControDataPath(), ref fileDataMap);
     return fileDataMap;
 }
示例#2
0
 public static void SaveEventControlDataMap(EventControlDataMap fileDataMap, int gameID, EventControlData fileData)
 {
     //Init Data Map
     if (fileDataMap == null || fileDataMap.MapFileData == null)
     {
         fileDataMap = new EventControlDataMap();
         fileDataMap.MapFileData = new Dictionary<int, EventControlData>();
     }
     //Init Data
     if (fileData == null || fileData.EventConfig == null)
     {
         fileData = new EventControlData();
         fileData.EventConfig = new Dictionary<string, EventConfig>();
     }
     //Save Data
     if (fileDataMap.MapFileData.ContainsKey(gameID))
     {
         fileDataMap.MapFileData[gameID] = fileData;
     }
     else
     {
         fileDataMap.MapFileData.Add(gameID, fileData);
     }
     //Save File
     byte[] data = ThriftSerialize.Serialize(fileDataMap);
     FileUtils.WriteByteFile(GetEventControDataPath(), data);
 }
示例#3
0
    public static void MergeEventControlDataMap(ref EventControlDataMap fileDataMap)
    {
        if (fileDataMap == null || fileDataMap.MapFileData == null)
        {
            fileDataMap = new EventControlDataMap();
            fileDataMap.MapFileData = new Dictionary<int, EventControlData>();
        }
        EventControlDataMap remoteDataMap = ConfigManager.Instance.GetEventControlDataMap();
        Dictionary<int, EventControlData> remoteData = remoteDataMap.MapFileData;
        Dictionary<int, EventControlData> localData = fileDataMap.MapFileData;
        foreach (int ID in remoteData.Keys)
        {
            if (localData.ContainsKey(ID))
            {

            }
            else
            {
                localData.Add(ID, remoteData[ID]);
            }
        }

        byte[] data = ThriftSerialize.Serialize(fileDataMap);
        FileUtils.WriteByteFile(GetEventControDataPath(), data);
    }