当前位置: 首页>>代码示例>>C#>>正文


C# SFSObject.PutSFSArray方法代码示例

本文整理汇总了C#中SFSObject.PutSFSArray方法的典型用法代码示例。如果您正苦于以下问题:C# SFSObject.PutSFSArray方法的具体用法?C# SFSObject.PutSFSArray怎么用?C# SFSObject.PutSFSArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SFSObject的用法示例。


在下文中一共展示了SFSObject.PutSFSArray方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: broadcastPositions

	public void broadcastPositions() {
		if(Time.time-lastBroadcastTime>MIN_TIME_BETWEEN_BROADCAST) {
			
			SFSObject o = new SFSObject();
			SFSArray h = new SFSArray();
			for(int i = 0;i<this.sortedHorses.Count;i++) {
				if(sortedHorses[i].currentPoint==null) 
					return;
				h.AddSFSObject(sortedHorses[i].dataPackage);
			}
			o.PutSFSArray("a",h);
			o.PutInt("f",this.framesPassed);
			SmartfoxConnectionHandler.REF.sendRaceMessage("b",o);
			lastBroadcastTime = Time.time;
		}
	}
开发者ID:dongvanhung,项目名称:HA3D,代码行数:16,代码来源:RaceTrack.cs

示例2: sendBlockDataSFSMessage

 private void sendBlockDataSFSMessage(object sender, DoWorkEventArgs e)
 {
     var blocks = e.Argument as List<float[]>;
     var obj = new SFSObject();
     obj.PutUtfString("type", "sync");
     var blocksArray = new SFSArray();
     foreach (var block in blocks) {
         var blockData = new SFSObject();
         blockData.PutFloatArray("position", new[] {block[0], block[1]});
         blockData.PutFloatArray("velocity", new[] {block[2], block[3]});
         blocksArray.AddSFSObject(blockData);
     }
     obj.PutSFSArray("blocks", blocksArray);
     smartFox.Send (new ObjectMessageRequest(obj));
 }
开发者ID:Daminvar,项目名称:Scatterblocks,代码行数:15,代码来源:GameManager.cs

示例3: DrawButtonsGUI

    private void DrawButtonsGUI(Rect screenPos, int userBoxWidth, int gameBoxWidth)
    {
        GUILayout.BeginArea(screenPos);
        GUILayout.BeginHorizontal();
        // Logout button
         	if (GUILayout.Button("Logout", buttonStyle, GUILayout.MaxWidth(userBoxWidth + 50)))
        {
            smartFox.Send(new LogoutRequest());
        }

        GUILayout.Space(screenPos.width - (userBoxWidth + gameBoxWidth + 125));

        // Game Room button
        if (GUILayout.Button("Make Game", buttonStyle, GUILayout.MaxWidth(gameBoxWidth + 125)))
        {
            if (currentActiveRoom.Name == "The Lobby")
            {

                Debug.Log("Make Game Button clicked");

                if (createdMyRoom)
                {
                    smartFox.Send(new JoinRoomRequest(username + " - Room", "", CurrentActiveRoom.Id));
                    return;
                }

                // ****** Create new room ******* //
                int gameLength = 120; //time in seconds

                //let smartfox take care of error if duplicate name
                RoomSettings settings = new RoomSettings(username + " - Room");
                // how many players allowed
                settings.MaxUsers = (short)maxPlayers;
                //settings.GroupId = "create";
                //settings.IsGame = true;

                List<RoomVariable> roomVariables = new List<RoomVariable>();
                //roomVariables.Add(new SFSRoomVariable("host", username));
                roomVariables.Add(new SFSRoomVariable("gameStarted", false));   //a game started bool

                SFSObject gameInfo = new SFSObject();
                gameInfo.PutUtfString("host", username);                        //the host
                SFSArray playerIDs = new SFSArray(); //[maxPlayers];

                gameInfo.PutSFSArray("playerIDs", playerIDs);                   //the player IDs
                gameInfo.PutInt("numTeams", numTeams);                          //the number of teams

                //hmmmmm
                SFSArray teams = new SFSArray();								//ASSIGN WHICH PLAYERS GO ON WHICH TEAMS
                int[] teamPlayerIndices;										// numTeams = 8, maxPlayers = 16
                for (int i = 0; i < numTeams; i++)								// i = 0, j = 0, j = 1, index = 0, index = 8
                {																// i = 1, j = 0, j = 1, index = 1, index = 9
                    teamPlayerIndices = new int[maxPlayers / numTeams];			// i = 2, j = 0, j = 1, index = 2, index = 10
                    for (int j = 0; j < maxPlayers / numTeams; j++)				// i = 3, j = 0, j = 1, index = 3, index = 11
                    { 															// ...
                        int index = i + (j * numTeams);
                        teamPlayerIndices[j] = index;							// i = 7, j = 0, j = 1, index = 7, index = 15
                    }

                    teams.AddIntArray(teamPlayerIndices);
                }
                gameInfo.PutSFSArray("teams", teams);                           //an array of possible values to be grabbed
                gameInfo.PutInt("gameLength", gameLength);                      //the length of the game

                roomVariables.Add(new SFSRoomVariable("gameInfo", gameInfo));

                settings.Variables = roomVariables;
                smartFox.Send(new CreateRoomRequest(settings, true, CurrentActiveRoom));           // Contains: maxUsers, and roomVariables
                createdMyRoom = true;
                Debug.Log("new room " + username + " - Room ");
            }
        }

        GUILayout.EndHorizontal();
        GUILayout.EndArea();
    }
开发者ID:eric-kansas,项目名称:Cubes-in-Space,代码行数:76,代码来源:Lobby.cs

示例4: DrawUsersGUI

    private void DrawUsersGUI(Rect screenPos)
    {
        GUILayout.BeginArea(screenPos);
        GUI.Box(new Rect(0, 0, screenPos.width, screenPos.height), "");
        GUILayout.BeginVertical();
        GUILayout.Label("Users");
        userScrollPosition = GUILayout.BeginScrollView(userScrollPosition, false, true, GUILayout.Width(screenPos.width));
        GUILayout.BeginVertical();
        List<User> userList = currentActiveRoom.UserList;
        foreach (User user in userList)
        {
            GUILayout.Label(user.Name);
        }
        GUILayout.EndVertical();
        GUILayout.EndScrollView();
        GUILayout.BeginHorizontal();
        // Logout button
        if (GUILayout.Button("Logout"))
        {
            smartFox.Send(new LogoutRequest());
        }
        // Game Room button
        if (currentActiveRoom.Name == "The Lobby")
        {
            if (GUILayout.Button("Make Game"))
            {
                Debug.Log("Make Game Button clicked");

                // ****** Create new room ******* //
                int gameLength = 120; //time in seconds

                //let smartfox take care of error if duplicate name
                RoomSettings settings = new RoomSettings(username + " - Room");
                // how many players allowed
                settings.MaxUsers = (short)maxPlayers;
                //settings.GroupId = "create";
                //settings.IsGame = true;

                List<RoomVariable> roomVariables = new List<RoomVariable>();
                //roomVariables.Add(new SFSRoomVariable("host", username));
                roomVariables.Add(new SFSRoomVariable("gameStarted", false));   //a game started bool
                // set up arrays of colors
                //SFSArray nums = new SFSArray();
                //for (int i = 0; i < 5; i++)
                //{
                //    nums.AddInt(i);
                //}
                //roomVariables.Add(new SFSRoomVariable("colorNums", nums));

                SFSObject gameInfo = new SFSObject();
                gameInfo.PutUtfString("host", username);                        //the host
                SFSArray playerIDs = new SFSArray(); //[maxPlayers];
                for (int i = 0; i < maxPlayers; i++)
                {
                    playerIDs.AddInt(i);
                }

                gameInfo.PutSFSArray("playerIDs", playerIDs);                   //the player IDs
                gameInfo.PutInt("numTeams", numTeams);                          //the number of teams

                SFSArray teams = new SFSArray();								//ASSIGN WHICH PLAYERS GO ON WHICH TEAMS
                int counter = 0;
                int[] teamPlayerIndices;										// numTeams = 8, maxPlayers = 16
                for (int i = 0; i < numTeams; i++)								// i = 0, j = 0, j = 1, index = 0, index = 8
                {																// i = 1, j = 0, j = 1, index = 1, index = 9
                    teamPlayerIndices = new int[maxPlayers / numTeams];			// i = 2, j = 0, j = 1, index = 2, index = 10
                    for (int j = 0; j < maxPlayers / numTeams; j++)				// i = 3, j = 0, j = 1, index = 3, index = 11
                    { 															// ...
                        int index = i + (j * numTeams);
                        teamPlayerIndices[j] = index;							// i = 7, j = 0, j = 1, index = 7, index = 15
                    }

                    teams.AddIntArray(teamPlayerIndices);
                }
                gameInfo.PutSFSArray("teams", teams);                           //an array of possible values to be grabbed
                gameInfo.PutInt("gameLength", gameLength);                      //the length of the game

                roomVariables.Add(new SFSRoomVariable("gameInfo", gameInfo));

                settings.Variables = roomVariables;
                smartFox.Send(new CreateRoomRequest(settings, true, CurrentActiveRoom));           // Contains: maxUsers, and roomVariables
                Debug.Log("new room " + username + "- Room");
            }
        }
        GUILayout.EndHorizontal();
        GUILayout.EndVertical();
        GUILayout.EndArea();
    }
开发者ID:ice0001,项目名称:Cubes-in-Space,代码行数:88,代码来源:Lobby.cs

示例5: sendHorsesArray

	public void sendHorsesArray(string aCommand,SFSArray aHorses)
	{
		SFSObject p = new SFSObject();
		p.PutSFSArray("horses",aHorses);
		sfs.Send(new ExtensionRequest(aCommand,p,null));
	}
开发者ID:dongvanhung,项目名称:HA3D,代码行数:6,代码来源:SmartfoxConnectionHandler.cs

示例6: toSFSObject

    public override SFSObject toSFSObject()
    {
        SFSObject sprintObject = new SFSObject();
        sprintObject.PutLong("Id_Sprint", this.getId_Sprint());
        sprintObject.PutLong("id_Proyecto", this.getId_Proyecto());
        sprintObject.PutUtfString("estado", this.getEstado());
        if(this.descripcion!=null)
            sprintObject.PutUtfString("descripcion", this.getDescripcion());
        else
            sprintObject.PutUtfString("descripcion", "");

        //usObject.PutLong ("fechaInicio", this.getFechaInicio ().toToFileTime ());
        sprintObject.PutUtfString ("fechaInicio", this.getFechaInicio().Year + "-"+this.getFechaInicio().Month+"-"+this.getFechaInicio().Day);
        //usObject.PutLong("fechaFin", this.getFechaFin().ToFileTime());
        sprintObject.PutUtfString ("fechaFin", this.getFechaFin().Year + "-"+this.getFechaFin().Month+"-"+this.getFechaFin().Day);
        sprintObject.PutUtfString("titulo",this.getTitulo());
        sprintObject.PutSFSArray("listaStories",this.getListaStoriesToSFSArray() );
        sprintObject.PutUtfString ("fecha_ultimo_cambio", this.get_fecha_ultimo_cambio ().ToString());
        sprintObject.PutBool ("cerrado", this.cerrado);
        return sprintObject;
    }
开发者ID:CristianCosta,项目名称:Kinect,代码行数:21,代码来源:Sprint.cs

示例7: SendTransform

 /// <summary>
 /// Send local transform to the server
 /// </summary>
 /// <param name="ntransform">
 /// A <see cref="NetworkTransform"/>
 /// </param>
 public void SendTransform(ISFSArray buffer)
 {
     if(send){
         Room room = smartFox.LastJoinedRoom;
         ISFSObject data = new SFSObject();
         data.PutSFSArray("transformBuffer",buffer);
         ExtensionRequest request = new ExtensionRequest("sendTransform", data, room, true); // True flag = UDP
         smartFox.Send(request);
     }
 }
开发者ID:CristianCosta,项目名称:Kinect,代码行数:16,代码来源:NetworkManager.cs

示例8: toSFSObject

 public override SFSObject toSFSObject()
 {
     SFSObject acceptanceCriteriaObject = new SFSObject();
     acceptanceCriteriaObject.PutLong("Id_Criteria", this.getId_Criteria());
     acceptanceCriteriaObject.PutLong("Id_Story", this.getId_Story());
     acceptanceCriteriaObject.PutLong("Prioridad", this.getPrioridad());
     acceptanceCriteriaObject.PutSFSArray ("listaTests", this.getListaTestToSFSArray ());
     acceptanceCriteriaObject.PutUtfString("Titulo", this.getTitulo());
     acceptanceCriteriaObject.PutUtfString("Descripcion", this.getDescripcion());
     return acceptanceCriteriaObject;
 }
开发者ID:CristianCosta,项目名称:Kinect,代码行数:11,代码来源:AcceptanceCriteria.cs

示例9: toSFSObject

 public override SFSObject toSFSObject()
 {
     SFSObject storyObject = new SFSObject();
     storyObject.PutLong("id_UserStory", this.getId_UserStory());
     storyObject.PutLong ("Id_Sprint", this.id_Sprint);
     storyObject.PutInt("prioridad", this.getPrioridad());
     storyObject.PutUtfString("descripcion", this.getDescripcion());
     storyObject.PutSFSArray("listaTareas", this.getListaTareasToSFSArray());
     storyObject.PutSFSArray("listaEstimacion", this.getListaEstimacionToSFSArray());
     storyObject.PutSFSArray ("listaCriterios", this.getListaCriteriosToSFSArray ());
     storyObject.PutInt("estadoEstimacion",this.getEstadoEstimacion());
     storyObject.PutFloat("valorEstimacion",this.getValorEstimacion());
     storyObject.PutLong("id_proyecto",this.getProyecto());
     storyObject.PutUtfString("Titulo",this.getTitulo());
     storyObject.PutBool("cerrada", this.cerrada);
     storyObject.PutUtfString ("fecha_ultimo_cambio", this.get_fecha_ultimo_cambio ().ToString());
     return storyObject;
 }
开发者ID:CristianCosta,项目名称:Kinect,代码行数:18,代码来源:UserStory.cs

示例10: toSFSObject

    public override SFSObject toSFSObject()
    {
        SFSObject taskObject = new SFSObject ();
        taskObject.PutLong ("id_Task", this.getId_Task ());
        taskObject.PutUtfString ("descripcion", this.getDescripcion ());
        taskObject.PutUtfString ("responsable", this.getResponsable ());
        taskObject.PutInt ("t_Estimado", this.getT_Estimado ());
        taskObject.PutInt ("t_Total", this.getT_Total ());
        taskObject.PutUtfString ("estado", this.getEstado ());
        taskObject.PutInt ("prioridad", this.getPrioridad ());
        taskObject.PutLong ("id_Story", this.getId_Story ());
        taskObject.PutUtfString ("titulo", this.getTitulo ());
        SFSArray t = new SFSArray ();

        foreach (long l in idTests) {
            SFSObject tsfs=new SFSObject();
            tsfs.PutLong("Id_Test", l);
            t.AddSFSObject(tsfs);
        }
        taskObject.PutSFSArray ("testsAsociados", t);
        //taskObject.pua
        //private ArrayList listaBurnDown;
        return taskObject;
    }
开发者ID:CristianCosta,项目名称:Kinect,代码行数:24,代码来源:Task.cs


注:本文中的SFSObject.PutSFSArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。