コード例 #1
0
        public void SaveRoomCacheToServer(SyncType type, string key, string value)
        {
            string     rid;
            MqttHelper mqttHelper = ChooseMqtt(type, out rid);

            if (mqttHelper == null)
            {
                return;
            }

            SaveRoomCache saveRoomCache = new SaveRoomCache();

            saveRoomCache.id         = (int)NetCmdId.SaveRoomCache;
            saveRoomCache.data       = new SaveRoomCache.ResultBean();
            saveRoomCache.data.rid   = rid;
            saveRoomCache.data.key   = key;
            saveRoomCache.data.value = value;

            string json = JsonConvert.SerializeObject(saveRoomCache);

            mqttHelper.PublishMsg(MessageType.System, SystemTargetId, json, new MqttSendMsgDelegate((bool res) =>
            {
            }));
        }
コード例 #2
0
        public void SaveSVRoomCacheToServer(string key, string value)
        {
            string     rid        = spectatorViewRid;
            MqttHelper mqttHelper = spectatorViewMqtt;

            if (spectatorViewNetState != NetState.Connect)
            {
                return;
            }

            SaveRoomCache saveRoomCache = new SaveRoomCache();

            saveRoomCache.id         = (int)NetCmdId.SaveRoomCache;
            saveRoomCache.data       = new SaveRoomCache.ResultBean();
            saveRoomCache.data.rid   = rid;
            saveRoomCache.data.key   = key;
            saveRoomCache.data.value = value;

            string json = JsonConvert.SerializeObject(saveRoomCache);

            mqttHelper.PublishMsg(MessageType.System, SystemTargetId, json, new MqttSendMsgDelegate((bool res) =>
            {
            }));
        }