예제 #1
0
    public static MissionRuleData ParseFromDictionary(System.Collections.Generic.Dictionary <string, object> ruleDict)
    {
        MissionRuleData ruleData = new MissionRuleData();

        if (ruleDict.ContainsKey("id"))
        {
            ruleData.Id = Convert.ToString(ruleDict["id"]);
        }
        if (ruleDict.ContainsKey("score"))
        {
            ruleData.Score = Convert.ToInt32(ruleDict["score"]);
        }
        if (ruleDict.ContainsKey("target"))
        {
            ruleData.Target = Convert.ToInt32(ruleDict["target"]);
        }
        if (ruleDict.ContainsKey("achieved"))
        {
            ruleData.Achieved = Convert.ToBoolean(ruleDict["achieved"]);
        }
        if (ruleDict.ContainsKey("variable"))
        {
            ruleData.Variable = Convert.ToString(ruleDict["variable"]);
        }
        if (ruleDict.ContainsKey("kind"))
        {
            ruleData.Kind = (MissionRuleType)Enum.Parse(typeof(MissionRuleType), Convert.ToString(ruleDict["kind"]));
        }
        if (ruleDict.ContainsKey("metadata"))
        {
            System.Collections.Generic.Dictionary <string, object> ruleMetadataDict = ruleDict["metadata"] as System.Collections.Generic.Dictionary <string, object>;
            ruleData.Metadata = MissionRuleMetadata.ParseFromDictionary(ruleMetadataDict);
        }
        return(ruleData);
    }
예제 #2
0
    public static MissionRuleMetadata ParseFromDictionary(System.Collections.Generic.Dictionary <string, object> metadataDict)
    {
        MissionRuleMetadata ruleDataMetadata = new MissionRuleMetadata();

        if (metadataDict != null)
        {
            if (metadataDict.ContainsKey("name"))
            {
                ruleDataMetadata.Name = Convert.ToString(metadataDict["name"]);
            }
            if (metadataDict.ContainsKey("gamedata"))
            {
                ruleDataMetadata.GameData = Convert.ToString(metadataDict["gamedata"]);
            }
        }
        return(ruleDataMetadata);
    }
예제 #3
0
 public static MissionRuleMetadata ParseFromDictionary( System.Collections.Generic.Dictionary<string,object> metadataDict )
 {
     MissionRuleMetadata ruleDataMetadata = new MissionRuleMetadata();
     if( metadataDict != null ) {
         if( metadataDict.ContainsKey( "name" ) ) {
             ruleDataMetadata.Name = Convert.ToString( metadataDict["name"] );
         }
         if( metadataDict.ContainsKey( "gamedata" ) ) {
             ruleDataMetadata.GameData = Convert.ToString( metadataDict["gamedata"] );
         }
     }
     return ruleDataMetadata;
 }