private ISFSArray ExpressionAsSFSArray() { ISFSArray iSFSArray = new SFSArray(); if (logicOp != null) { iSFSArray.AddUtfString(logicOp.Id); } else { iSFSArray.AddNull(); } iSFSArray.AddUtfString(varName); iSFSArray.AddByte((byte)condition.Type); iSFSArray.AddUtfString(condition.Symbol); if (condition.Type == 0) { iSFSArray.AddBool(Convert.ToBoolean(varValue)); } else if (condition.Type == 1) { iSFSArray.AddDouble(Convert.ToDouble(varValue)); } else { iSFSArray.AddUtfString(Convert.ToString(varValue)); } return(iSFSArray); }
public void addSuscriber(string name) { currentConectionName = name; Debug.Log("addSuscriber"); List<RoomVariable> roomVars = new List<RoomVariable>(); Room room = smartFox.LastJoinedRoom; RoomVariable aux = room.GetVariable("RoomVC"); SFSArray array = (SFSArray)aux.GetSFSArrayValue(); SFSArray user; SFSArray conection; for(int i=0; i<array.Size(); i++){ conection = (SFSArray)array.GetSFSArray(i); user = (SFSArray)conection.GetSFSArray(0); if (user.GetUtfString(0) == name){ user = new SFSArray(); user.AddUtfString(currentName); user.AddUtfString(ip); array.GetSFSArray(i).AddSFSArray(user); } } roomVars.Add( new SFSRoomVariable("RoomVC", array) ); smartFox.Send ( new SetRoomVariablesRequest(roomVars, smartFox.LastJoinedRoom) ); printRoomVC(); }
public void addConection() { Debug.Log("addConection"); List<RoomVariable> roomVars = new List<RoomVariable>(); Room room = smartFox.LastJoinedRoom; RoomVariable aux = room.GetVariable("RoomVC"); SFSArray array = new SFSArray(); if (aux != null) array = (SFSArray)aux.GetSFSArrayValue(); SFSArray user = new SFSArray(); user.AddUtfString(currentName); user.AddUtfString(ip); SFSArray conection = new SFSArray(); conection.AddSFSArray(user); array.AddSFSArray(conection); roomVars.Add( new SFSRoomVariable("RoomVC", array) ); smartFox.Send ( new SetRoomVariablesRequest(roomVars, smartFox.LastJoinedRoom) ); }
override public SFSObject ToSfsObj() { var data = base.ToSfsObj(); data.PutUtfString(dataKeys.How.ToString(), How); SFSArray CategorieSfsArray = new SFSArray(); foreach (var item in Categories) { CategorieSfsArray.AddUtfString(item); } data.PutSFSArray(dataKeys.categories.ToString(), CategorieSfsArray); var ingreadientSfsArray = new SFSArray(); foreach (var item in Ingreadients) { ingreadientSfsArray.AddUtfString(item); } data.PutSFSArray(dataKeys.ingreadiants.ToString(), ingreadientSfsArray); return(data); }
void Start() { smartFox = SmartFoxConnection.Connection; AddEventListeners(); _roundsInt = rounds; UpdateTeamLists(); SFSArray myTeamUpdate = new SFSArray(); if (blueTeam.Count < redTeam.Count) { isBlueTeam = true; } List<RoomVariable> roomVars = new List<RoomVariable>(); if (isBlueTeam) { blueTeam.Add(smartFox.MySelf.Name); foreach(string name in blueTeam) { myTeamUpdate.AddUtfString(name); } roomVars.Add(new SFSRoomVariable("blue", myTeamUpdate)); if (smartFox.LastJoinedRoom.GetVariable("blueRobot").GetStringValue() == "") { roomVars.Add(new SFSRoomVariable("blueRobot", smartFox.MySelf.Name)); } } else { redTeam.Add(smartFox.MySelf.Name); foreach(string name in redTeam) { myTeamUpdate.AddUtfString(name); } roomVars.Add(new SFSRoomVariable("red", myTeamUpdate)); if (smartFox.LastJoinedRoom.GetVariable("redRobot").GetStringValue() == "") { roomVars.Add(new SFSRoomVariable("redRobot", smartFox.MySelf.Name)); } } List<RoomVariable> variables = smartFox.LastJoinedRoom.GetVariables(); foreach(RoomVariable roomVar in variables) { Debug.Log(roomVar.Name); } smartFox.Send(new SetRoomVariablesRequest(roomVars,smartFox.LastJoinedRoom)); }