本文整理汇总了C#中SFSObject.PutUtfStringArray方法的典型用法代码示例。如果您正苦于以下问题:C# SFSObject.PutUtfStringArray方法的具体用法?C# SFSObject.PutUtfStringArray怎么用?C# SFSObject.PutUtfStringArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SFSObject
的用法示例。
在下文中一共展示了SFSObject.PutUtfStringArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnJoinRoom
public void OnJoinRoom(BaseEvent evt)
{
Room room = (Room)evt.Params["room"];
currentRoom = room;
Debug.Log("onjoinroom = " + currentRoom.Name);
//unlock the mouse
Screen.lockCursor = false;
Screen.showCursor = true;
if (room.Name == "The Lobby")
{
//smartFox.RemoveAllEventListeners();
Debug.Log("onjoinroom = " + smartFox.LastJoinedRoom.Name);
Application.LoadLevel("The Lobby");
}
else if (room.IsGame)
{
//this is the game, so it should never actually happen
Debug.Log("This is the game and should be loaded");
}
else
{
smartFox.RemoveAllEventListeners();
//Debug.Log("GameRoom- OnJoinRoom: joined " + room.Name);
if (GameValues.isHost)
{
//pass an updated room variable to the game lobby that talk about the scores
ISFSObject obj = new SFSObject();
string winner;
obj.PutIntArray("scores", teamScores.ToArray());
List<String> teamColors = new List<String>();
int i;
for (i = 0; i < numberOfTeams; i++)
{
switch (i)
{
case 0:
teamColors.Add("Red");
break;
case 1:
teamColors.Add("Blue");
break;
case 2:
teamColors.Add("Green");
break;
case 3:
teamColors.Add("Yellow");
break;
case 4:
teamColors.Add("Purple");
break;
case 5:
teamColors.Add("Orange");
break;
case 6:
teamColors.Add("Pink");
break;
case 7:
teamColors.Add("Teal");
break;
default:
break;
}
}
int highestScore = -1;
winner = "Tie";
for (i = 0; i < numberOfTeams; i++)
{
if (teamScores[i] > highestScore)
{
winner = teamColors[i];
highestScore = teamScores[i];
}
else if (teamScores[i] == highestScore)
{
if (winner.Contains("Tie: "))
{
winner += ", " + teamColors[i];
}
else
{
winner = "Tie: " + winner + ", " + teamColors[i];
}
}
}
obj.PutUtfString("winner", winner);
obj.PutUtfStringArray("teamColors", teamColors.ToArray());
List<RoomVariable> rm = new List<RoomVariable>();
rm.Add(new SFSRoomVariable("lastGameScores", obj));
smartFox.Send(new SetRoomVariablesRequest(rm));
}
Application.LoadLevel("Game Lobby");
Debug.Log("loading Game Lobby");
//smartFox.Send(new SpectatorToPlayerRequest());
}
//.........这里部分代码省略.........
示例2: StartGame
public void StartGame()
{
ISFSObject isfsO = new SFSObject();
isfsO.PutInt("Sender", sfs.MySelf.PlayerId);
List<string> s = new List<string>();
var items = from pair in listPlayer orderby pair.Key ascending select pair;
foreach (KeyValuePair<int, string> entry in items)
{
s.Add(entry.Key + ":" + entry.Value);
Debug.Log(entry.Key + ":" + entry.Value);
}
isfsO.PutUtfStringArray("ListPlayer", s.ToArray());
sfs.Send(new ExtensionRequest(ConfigRequestCmd.cmd_playerstart, isfsO, sfs.LastJoinedRoom));
}
示例3: SendBlockObject
public static void SendBlockObject(int blockType, string id, string[] cubeIDs, Vector3 position, Vector3 rotation)
{
SFSObject message = new SFSObject ();
message.PutUtfString ("messageType", "UpdatePosition");
message.PutUtfString ("objectType", "Block");
message.PutFloat ("xPos", position.x);
message.PutFloat ("yPos", position.y);
message.PutFloat ("zPos", position.z);
message.PutFloat ("xRot", rotation.x);
message.PutFloat ("yRot", rotation.y);
message.PutFloat ("zRot", rotation.z);
message.PutInt ("blockType", blockType);
message.PutUtfStringArray ("cubeIDs", cubeIDs);
message.PutUtfString ("ID", id);
Networking.SendData (message);
}