/// <summary> /// creates the message to be sent to the server /// </summary> void CreateMessage() { ObjectInfo info = new ObjectInfo(); info.ObjType = focused.name; //create message entry MsgEntry entry = new MsgEntry(); entry.OpType = MsgEntry.Types.OP_TYPE.Upd; entry.ShowId = showObject.ShowId; //add the camera's current position entry.Pr.Add(mainCamera.transform.position.x); entry.Pr.Add(mainCamera.transform.position.y); entry.Pr.Add(mainCamera.transform.position.z); //add the focused object position entry.Pr.Add(focused.transform.position.x); entry.Pr.Add(focused.transform.position.y); entry.Pr.Add(focused.transform.position.z); //add the name of the focusedObject entry.Info = info; //create sync message SyncMsg msg = new SyncMsg(); msg.MsgEntry.Add(entry); //send message cm.SendMessage(msg); }
/// <summary> /// manages the color of the cell according to the player that clicks it /// </summary> /// <param name="ip"></param> private void ClickCube(string ip, string cellname, float cellcount) { if (ip == playerA.id) { CurrentColor = 0; blueCounter += 1; if (blueCounter > 3) { blueSelection.Clear(); blueCounter = 1; } counter = blueCounter; } if (ip == playerB.id) { CurrentColor = CType.green; greenCounter += 1; if (greenCounter > 3) { greenSelection.Clear(); greenCounter = 1; } counter = greenCounter; } MsgEntry entry = new MsgEntry(); entry.OpType = MsgEntry.Types.OP_TYPE.Upd; entry.ShowId = ip; ObjectInfo info = new ObjectInfo(); info.ObjType = cellname; entry.Info = info; entry.Pr.Add(counter); entry.Pr.Add(cellcount); entry.Vec.Add((long)CurrentColor); SyncMsg msg = new SyncMsg(); msg.MsgEntry.Add(entry); collaborationManager.SendMessage(msg); }
public void SelectOnePlanet(string name, System.Action cb = null, bool sendMsg = true, bool animating = true, float animationStartUniverseTime = -1) { if (selected) { //Debug.Log("Select Blocked!!!!!!!!!!!"); return; } if (planetMap.ContainsKey(name)) { PlanetObject sel = planetMap[name]; if (sendMsg && connectToServer) { MsgEntry me_toSend = sel.CreateMsgEntry(); SyncMsg sync = new SyncMsg(); sync.MsgEntry.Add(me_toSend); Debug.Log("Send select plaent![" + name + "]"); cm.SendMessage(sync); } } }
void Update() { if (collaborationManager != null) { if (collaborationManager.enterRoomResult == EnterRoomResult.EnterRoomSuccess) { MsgEntry entry = new MsgEntry(); entry.OpType = MsgEntry.Types.OP_TYPE.Upd; entry.ShowId = "Test"; GetTransformFloat(cube.transform, entry); SyncMsg msg = new SyncMsg(); msg.MsgEntry.Add(entry); collaborationManager.SendMessage(msg); } } }
private void ClickCube() { CurrentColor += 1; if ((int)CurrentColor > 2) { CurrentColor = 0; } MsgEntry entry = new MsgEntry(); entry.OpType = MsgEntry.Types.OP_TYPE.Upd; entry.ShowId = showObject.ShowId; entry.Vec.Add((long)CurrentColor); SyncMsg msg = new SyncMsg(); msg.MsgEntry.Add(entry); cm.SendMessage(msg); }
private void RequestToServer() { if (cm != null) { if (cm.enterRoomResult == EnterRoomResult.EnterRoomSuccess) { MsgEntry entry = new MsgEntry(); entry.OpType = MsgEntry.Types.OP_TYPE.Upd; entry.ShowId = m_showObject.ShowId; entry.Vec.Add((long)m_behaviourType); if (m_behaviourType == BehaviourType.FingerDrag) { GetTransformFloat(this.transform, entry); } SyncMsg msg = new SyncMsg(); msg.MsgEntry.Add(entry); cm.SendMessage(msg); } } }