예제 #1
0
    public static void FromJson(string json)
    {
        List <object> list = json.listFromJson();


        _map   = new Dictionary <int, ConfigWord>(list.Count);
        _datas = new List <ConfigWord>(list.Count);

        for (int i = 0; i < list.Count; i++)
        {
            Dictionary <string, object> inDict = list[i] as Dictionary <string, object>;
            ConfigWord data = FromJson(inDict);
            _map.Add(data.Id, data);
            _datas.Add(data);
        }
    }
예제 #2
0
    static ConfigWord FromJson(Dictionary <string, object> inDict)
    {
        ConfigWord data = new ConfigWord();

        if (inDict.ContainsKey("Id"))
        {
            data.Id = inDict["Id"].GetJsonConverter().toInt();
        }
        if (inDict.ContainsKey("TextContent"))
        {
            data.TextContent = inDict["TextContent"].GetJsonConverter().toStr();
        }
        if (inDict.ContainsKey("Talk"))
        {
            data.Talk = inDict["Talk"].GetJsonConverter().toInt();
        }

        return(data);
    }
예제 #3
0
    private void OnChat(object[] objs)
    {
        int       position = (int)objs[0];
        int       idx      = Game.MJMgr.GetIndexByPosition(position);
        PlayerSub player   = players[idx];

        int type = (int)objs[1];

        switch (type)
        {
        case 0:
            int index = (int)objs[2];
            player.ShowMood(index);
            break;

        case 1:
            int        id     = (int)objs[2];
            ConfigWord config = ConfigWord.GetByKey(id);
            if (null != config)
            {
                player.ShowWord(config.TextContent);
                Game.SoundManager.PlayVoice(position, config.Talk);
            }
            break;

        case 2:
            string str = (string)objs[2];
            player.ShowWord(str);
            break;

        case 3:
            byte[] data = (byte[])objs[2];
            player.ShowVoice(data, detail.AudioSource_MicrophoneInput);
            break;
        }
    }
예제 #4
0
 /// <summary>
 /// Retrieve configuration word
 /// </summary>
 /// <param name="inputData"></param>
 /// <returns></returns>
 public ConfigWord GetConfigWord(UInt16 inputData)
 {
     ConfigWord cfgWord = new ConfigWord();
     /* format config data*/
     if ((inputData & 0x8000) != 0)
     {
         cfgWord.TamperAlarm = true;
     }
     if ((inputData & 0x4000) != 0)
     {
         cfgWord.ExternalSupply = true;
     }
     if ((inputData & 0x2000) != 0)
     {
         cfgWord.RFU2 = true;
     }
     if ((inputData & 0x1000) != 0)
     {
         cfgWord.RFU3 = true;
     }
     if ((inputData & 0x0800) != 0)
     {
         cfgWord.InvertDigitalOutput = true;
     }
     if ((inputData & 0x0400) != 0)
     {
         cfgWord.TransparentMode = true;
     }
     if ((inputData & 0x0200) != 0)
     {
         cfgWord.DataMode = true;
     }
     if ((inputData & 0x0100) != 0)
     {
         cfgWord.ConditionalReadRangeReduction_onOff = true;
     }
     if ((inputData & 0x0080) != 0)
     {
         cfgWord.ConditionalReadRangeReduction_openShort = true;
     }
     if ((inputData & 0x0040) != 0)
     {
         cfgWord.MaxBackscatterStrength = true;
     }
     if ((inputData & 0x0020) != 0)
     {
         cfgWord.DigitalOutput = true;
     }
     if ((inputData & 0x0010) != 0)
     {
         cfgWord.PrivacyMode = true;
     }
     if ((inputData & 0x0008) != 0)
     {
         cfgWord.ReadProtectUser = true;
     }
     if ((inputData & 0x0004) != 0)
     {
         cfgWord.ReadProtectEPC = true;
     }
     if ((inputData & 0x0002) != 0)
     {
         cfgWord.ReadProtectTID = true;
     }
     if ((inputData & 0x0001) != 0)
     {
         cfgWord.PsfAlarm = true;
     }
     return cfgWord;
 }
예제 #5
0
 /// <summary>
 /// Format the config word
 /// </summary>
 /// <param name="inputData">input data</param>
 private void SetConfigWord(ConfigWord inputData)
 {
     // format config data
     ConfigWord = 0x0000;
     if (inputData.TamperAlarm)
     {
         ConfigWord |= (0x0001 << 15);
     }
     if (inputData.ExternalSupply)
     {
         ConfigWord |= (0x0001 << 14);
     }
     if (inputData.RFU2)
     {
         ConfigWord |= (0x0001 << 13);
     }
     if (inputData.RFU3)
     {
         ConfigWord |= (0x0001 << 12);
     }
     if (inputData.InvertDigitalOutput)
     {
         ConfigWord |= (0x0001 << 11);
     }
     if (inputData.TransparentMode)
     {
         ConfigWord |= (0x0001 << 10);
     }
     if (inputData.DataMode)
     {
         ConfigWord |= (0x0001 << 9);
     }
     if (inputData.ConditionalReadRangeReduction_onOff)
     {
         ConfigWord |= (0x0001 << 8);
     }
     if (inputData.ConditionalReadRangeReduction_openShort)
     {
         ConfigWord |= (0x0001 << 7);
     }
     if (inputData.MaxBackscatterStrength)
     {
         ConfigWord |= (0x0001 << 6);
     }
     if (inputData.DigitalOutput)
     {
         ConfigWord |= (0x0001 << 5);
     }
     if (inputData.PrivacyMode)
     {
         ConfigWord |= (0x0001 << 4);
     }
     if (inputData.ReadProtectUser)
     {
         ConfigWord |= (0x0001 << 3);
     }
     if (inputData.ReadProtectEPC)
     {
         ConfigWord |= (0x0001 << 2);
     }
     if (inputData.ReadProtectTID)
     {
         ConfigWord |= (0x0001 << 1);
     }
     if (inputData.PsfAlarm)
     {
         ConfigWord |= 0x0001;
     }
 }
예제 #6
0
 /// <summary>
 /// Constructor to initialize parameters of NxpConfigChange
 /// </summary>
 /// <param name="accessPassword">the access password</param>
 /// <param name="configWord">Config Word</param>
 public ChangeConfig(UInt32 accessPassword, ConfigWord configWord): base(accessPassword)
 {
     ChipType = 0x07;
     SetConfigWord(configWord);
 }