private void PopulateArrayWithValue(ISFSArray arr) { switch (type) { case VariableType.NULL: arr.AddNull(); break; case VariableType.BOOL: arr.AddBool(GetBoolValue()); break; case VariableType.INT: arr.AddInt(GetIntValue()); break; case VariableType.DOUBLE: arr.AddDouble(GetDoubleValue()); break; case VariableType.STRING: arr.AddUtfString(GetStringValue()); break; case VariableType.OBJECT: arr.AddSFSObject(GetSFSObjectValue()); break; case VariableType.ARRAY: arr.AddSFSArray(GetSFSArrayValue()); break; } }
public override void Execute(SmartFox sfs) { ISFSArray iSFSArray = SFSArray.NewInstance(); foreach (BuddyVariable buddyVariable in buddyVariables) { iSFSArray.AddSFSArray(buddyVariable.ToSFSArray()); } sfso.PutSFSArray(KEY_BUDDY_VARS, iSFSArray); }
public override void Execute(SmartFox sfs) { ISFSArray iSFSArray = SFSArray.NewInstance(); foreach (UserVariable userVariable in userVariables) { iSFSArray.AddSFSArray(userVariable.ToSFSArray()); } sfso.PutSFSArray(KEY_VAR_LIST, iSFSArray); }
public override void Execute(SmartFox sfs) { ISFSArray iSFSArray = SFSArray.NewInstance(); foreach (RoomVariable roomVariable in roomVariables) { iSFSArray.AddSFSArray(roomVariable.ToSFSArray()); } if (room == null) { room = sfs.LastJoinedRoom; } sfso.PutSFSArray(KEY_VAR_LIST, iSFSArray); sfso.PutInt(KEY_VAR_ROOM, room.Id); }
public override void Execute(SmartFox sfs) { sfso.PutUtfString(KEY_NAME, settings.Name); sfso.PutUtfString(KEY_GROUP_ID, settings.GroupId); sfso.PutUtfString(KEY_PASSWORD, settings.Password); sfso.PutBool(KEY_ISGAME, settings.IsGame); sfso.PutShort(KEY_MAXUSERS, settings.MaxUsers); sfso.PutShort(KEY_MAXSPECTATORS, settings.MaxSpectators); sfso.PutShort(KEY_MAXVARS, settings.MaxVariables); sfso.PutBool(KEY_ALLOW_JOIN_INVITATION_BY_OWNER, settings.AllowOwnerOnlyInvitation); if (settings.Variables != null && settings.Variables.Count > 0) { ISFSArray iSFSArray = SFSArray.NewInstance(); foreach (RoomVariable variable in settings.Variables) { if (variable is RoomVariable) { RoomVariable roomVariable = variable as RoomVariable; iSFSArray.AddSFSArray(roomVariable.ToSFSArray()); } } sfso.PutSFSArray(KEY_ROOMVARS, iSFSArray); } if (settings.Permissions != null) { List <bool> list = new List <bool>(); list.Add(settings.Permissions.AllowNameChange); list.Add(settings.Permissions.AllowPasswordStateChange); list.Add(settings.Permissions.AllowPublicMessages); list.Add(settings.Permissions.AllowResizing); sfso.PutBoolArray(KEY_PERMISSIONS, list.ToArray()); } if (settings.Events != null) { List <bool> list2 = new List <bool>(); list2.Add(settings.Events.AllowUserEnter); list2.Add(settings.Events.AllowUserExit); list2.Add(settings.Events.AllowUserCountChange); list2.Add(settings.Events.AllowUserVariablesUpdate); sfso.PutBoolArray(KEY_EVENTS, list2.ToArray()); } if (settings.Extension != null) { sfso.PutUtfString(KEY_EXTID, settings.Extension.Id); sfso.PutUtfString(KEY_EXTCLASS, settings.Extension.ClassName); if (settings.Extension.PropertiesFile != null && settings.Extension.PropertiesFile.Length > 0) { sfso.PutUtfString(KEY_EXTPROP, settings.Extension.PropertiesFile); } } if (settings is MMORoomSettings) { MMORoomSettings mMORoomSettings = settings as MMORoomSettings; if (mMORoomSettings.DefaultAOI.IsFloat()) { sfso.PutFloatArray(KEY_MMO_DEFAULT_AOI, mMORoomSettings.DefaultAOI.ToFloatArray()); if (mMORoomSettings.MapLimits != null) { sfso.PutFloatArray(KEY_MMO_MAP_LOW_LIMIT, mMORoomSettings.MapLimits.LowerLimit.ToFloatArray()); sfso.PutFloatArray(KEY_MMO_MAP_HIGH_LIMIT, mMORoomSettings.MapLimits.HigherLimit.ToFloatArray()); } } else { sfso.PutIntArray(KEY_MMO_DEFAULT_AOI, mMORoomSettings.DefaultAOI.ToIntArray()); if (mMORoomSettings.MapLimits != null) { sfso.PutIntArray(KEY_MMO_MAP_LOW_LIMIT, mMORoomSettings.MapLimits.LowerLimit.ToIntArray()); sfso.PutIntArray(KEY_MMO_MAP_HIGH_LIMIT, mMORoomSettings.MapLimits.HigherLimit.ToIntArray()); } } sfso.PutShort(KEY_MMO_USER_MAX_LIMBO_SECONDS, (short)mMORoomSettings.UserMaxLimboSeconds); sfso.PutShort(KEY_MMO_PROXIMITY_UPDATE_MILLIS, (short)mMORoomSettings.ProximityListUpdateMillis); sfso.PutBool(KEY_MMO_SEND_ENTRY_POINT, mMORoomSettings.SendAOIEntryPoint); } sfso.PutBool(KEY_AUTOJOIN, autoJoin); if (roomToLeave != null) { sfso.PutInt(KEY_ROOM_TO_LEAVE, roomToLeave.Id); } }