Пример #1
0
 public void RefreshMembership(SignedResponse <MembershipRightsRefresh> rights)
 {
     mt.send(SmartfoxCommand.MEMBERSHIP_REFRESH, new Dictionary <string, SFSDataWrapper>
     {
         {
             "rights",
             SmartFoxGameServerClientShared.serialize(mt.JsonService.Serialize(rights))
         }
     });
 }
Пример #2
0
 public void SendIglooUpdated(SignedResponse <IglooData> signedIglooData)
 {
     mt.send(SmartfoxCommand.IGLOO_UPDATED, new Dictionary <string, SFSDataWrapper>
     {
         {
             "igloo_data",
             SmartFoxGameServerClientShared.serialize(mt.JsonService.Serialize(signedIglooData), asText: true)
         }
     });
 }
Пример #3
0
 public void SendRewardNotification(SignedResponse <RewardedUserCollectionJsonHelper> rewardCollection)
 {
     mt.send(SmartfoxCommand.SEND_EARNED_REWARDS, new Dictionary <string, SFSDataWrapper>
     {
         {
             "reward",
             SmartFoxGameServerClientShared.serialize(mt.JsonService.Serialize(rewardCollection))
         }
     });
 }
Пример #4
0
 public void EquipDispensable(int id)
 {
     mt.send(SmartfoxCommand.EQUIP_DISPENSABLE, new Dictionary <string, SFSDataWrapper>
     {
         {
             "type",
             SmartFoxGameServerClientShared.serialize(id)
         }
     });
 }
Пример #5
0
 public void PrototypeSendAction(object data)
 {
     mt.send(SmartfoxCommand.PROTOTYPE, new Dictionary <string, SFSDataWrapper>
     {
         {
             "data",
             SmartFoxGameServerClientShared.serialize(mt.JsonService.Serialize(data))
         }
     });
 }
Пример #6
0
 public void EquipDurable(SignedResponse <EquipDurableResponse> durable)
 {
     mt.send(SmartfoxCommand.EQUIP_DURABLE, new Dictionary <string, SFSDataWrapper>
     {
         {
             "type",
             SmartFoxGameServerClientShared.serialize(mt.JsonService.Serialize(durable))
         }
     });
 }
Пример #7
0
 public void SetConsumableInventory(SignedResponse <ConsumableInventory> inventory)
 {
     mt.send(SmartfoxCommand.SET_CONSUMABLE_INVENTORY, new Dictionary <string, SFSDataWrapper>
     {
         {
             "data",
             SmartFoxGameServerClientShared.serialize(mt.JsonService.Serialize(inventory))
         }
     });
 }
Пример #8
0
 public void QuestSetQuestState(SignedResponse <QuestStateCollection> quests)
 {
     mt.send(SmartfoxCommand.SET_QUEST_STATES, new Dictionary <string, SFSDataWrapper>
     {
         {
             "data",
             SmartFoxGameServerClientShared.serialize(mt.JsonService.Serialize(quests))
         }
     });
 }
Пример #9
0
 public void QuestCompleteObjective(string objective)
 {
     mt.send(SmartfoxCommand.COMPLETE_OBJECTIVE, new Dictionary <string, SFSDataWrapper>
     {
         {
             "obj",
             SmartFoxGameServerClientShared.serialize(objective)
         }
     });
 }
Пример #10
0
 public void GetPlayerLocation(string swid)
 {
     mt.send(SmartfoxCommand.GET_PLAYER_LOCATION, new Dictionary <string, SFSDataWrapper>
     {
         {
             "swid",
             SmartFoxGameServerClientShared.serialize(swid)
         }
     });
 }
Пример #11
0
 public void SendWebServiceEvent(SignedResponse <WebServiceEvent> wsEvent)
 {
     mt.send(SmartfoxCommand.WEBSERVICE_EVENT, new Dictionary <string, SFSDataWrapper>
     {
         {
             "d",
             SmartFoxGameServerClientShared.serialize(mt.JsonService.Serialize(wsEvent))
         }
     }, new object[1]
     {
         wsEvent.Data.type
     });
 }
Пример #12
0
 public void ReuseConsumable(string type, object properties)
 {
     mt.send(SmartfoxCommand.REUSE_CONSUMABLE, new Dictionary <string, SFSDataWrapper>
     {
         {
             "type",
             SmartFoxGameServerClientShared.serialize(type)
         },
         {
             "prop",
             SmartFoxGameServerClientShared.serialize(mt.JsonService.Serialize(properties))
         }
     });
 }
Пример #13
0
 public void UseConsumable(SignedResponse <UsedConsumable> consumable, object properties)
 {
     mt.send(SmartfoxCommand.USE_CONSUMABLE, new Dictionary <string, SFSDataWrapper>
     {
         {
             "type",
             SmartFoxGameServerClientShared.serialize(mt.JsonService.Serialize(consumable))
         },
         {
             "prop",
             SmartFoxGameServerClientShared.serialize(mt.JsonService.Serialize(properties))
         }
     });
 }
Пример #14
0
 public void Pickup(string id, string tag, Vector3 position)
 {
     mt.send(SmartfoxCommand.PICKUP, new Dictionary <string, SFSDataWrapper>
     {
         {
             "id",
             SmartFoxGameServerClientShared.serialize(id)
         },
         {
             "t",
             SmartFoxGameServerClientShared.serialize(tag)
         },
         {
             "p",
             SmartFoxGameServerClientShared.serialize(position)
         }
     });
 }
Пример #15
0
 public void SendPartyGameSessionMessage(int sessionId, int type, object properties)
 {
     mt.send(SmartfoxCommand.PARTY_GAME_MESSAGE, new Dictionary <string, SFSDataWrapper>
     {
         {
             "id",
             SmartFoxGameServerClientShared.serialize(sessionId)
         },
         {
             "type",
             SmartFoxGameServerClientShared.serialize(type)
         },
         {
             "message",
             SmartFoxGameServerClientShared.serialize(mt.JsonService.Serialize(properties))
         }
     });
 }
Пример #16
0
        public void EncryptParameter(string parameterKey, Dictionary <string, SFSDataWrapper> parameters)
        {
            if (!parameters.ContainsKey(parameterKey))
            {
                throw new Exception("Failed to encrypt parameter '" + parameterKey + "'. Parameter not found.");
            }
            SFSDataWrapper sFSDataWrapper = parameters[parameterKey];

            if (sFSDataWrapper.Type != 8)
            {
                throw new Exception("Failed to encrypt parameter '" + parameterKey + "'. Parameter is not a UTF string.");
            }
            string s = sFSDataWrapper.Data.ToString();

            byte[] bytes   = Encoding.UTF8.GetBytes(s);
            byte[] inArray = Encrypt(bytes);
            string str     = Convert.ToBase64String(inArray);

            parameters[parameterKey] = SmartFoxGameServerClientShared.serialize(str);
            parameters.Add(ENCRYPTED_PARAMETER, SmartFoxGameServerClientShared.serialize(parameterKey));
        }
Пример #17
0
    public void SendChatMessage(SignedResponse <ChatMessage> signedChatMessage)
    {
        Dictionary <string, SFSDataWrapper> dictionary = new Dictionary <string, SFSDataWrapper>();

        dictionary.Add("msg", SmartFoxGameServerClientShared.serialize(mt.JsonService.Serialize(signedChatMessage)));
        Dictionary <string, SFSDataWrapper> parameters = dictionary;

        if (mt.SmartFoxEncryptor != null)
        {
            try
            {
                mt.SmartFoxEncryptor.EncryptParameter("msg", parameters);
            }
            catch (Exception ex)
            {
                Log.LogErrorFormatted(this, "Failed to encrypt parameter. Exception: {0}", ex);
                Log.LogException(this, ex);
            }
        }
        mt.send(SmartfoxCommand.CHAT, parameters);
    }
Пример #18
0
    public void TriggerLocomotionAction(LocomotionActionEvent action, bool droppable)
    {
        Dictionary <string, SFSDataWrapper> dictionary = new Dictionary <string, SFSDataWrapper>();

        dictionary.Add("a", SmartFoxGameServerClientShared.serialize((byte)action.Type));
        dictionary.Add("p", SmartFoxGameServerClientShared.serialize(action.Position));
        dictionary.Add("t", SmartFoxGameServerClientShared.serialize(ServerTime));
        Dictionary <string, SFSDataWrapper> dictionary2 = dictionary;

        if (action.Direction.HasValue)
        {
            dictionary2.Add("d", SmartFoxGameServerClientShared.serialize(action.Direction.Value));
        }
        if (action.Velocity.HasValue)
        {
            dictionary2.Add("v", SmartFoxGameServerClientShared.serialize(action.Velocity.Value));
        }
        if (action.Object != null)
        {
            dictionary2.Add("o", SmartFoxGameServerClientShared.serialize(mt.JsonService.Serialize(action.Object)));
        }
        mt.send(SmartfoxCommand.LOCOMOTION_ACTION, dictionary2, null, droppable);
    }
Пример #19
0
 public SmartFoxGameServerClient(ClubPenguinClient clubPenguinClient, string gameZone, bool gameEncryption, bool gameDebugging, bool lagMonitoring)
 {
     mt = new SmartFoxGameServerClientShared(clubPenguinClient, gameZone, gameEncryption, gameDebugging, lagMonitoring);
     CoroutineRunner.StartPersistent(processMessagesCoroutine(), this, "Smartfox message procession");
 }