/// <summary> /// Handles the Claim Action Message from the server. Passes the data onto the voxel editor. /// </summary> /// <param name="props">Properties.</param> public void ClaimObjectMessage(Dictionary<string, object> props) { int objectID = (int)props["id"]; string prefabName = (string)props["gameObject"]; Vector3 loc = (Vector3)props["loc"]; Quaternion orient = (Quaternion)props["orient"]; int claimID = (int)props["claimID"]; //string state = (string)props["state"]; AtavismLogger.LogDebugMessage("Got claim object: " + gameObject); //SpawnClaimObject(objectID, claimID, prefabName, loc, orient); ClaimObjectData objectData = new ClaimObjectData(); objectData.objectID = objectID; objectData.claimID = claimID; objectData.prefabName = prefabName; objectData.loc = loc; objectData.orient = orient; objectData.state = ""; objectsToLoad.Add(objectData); }
/// <summary> /// Handles the Claim Action Bulk Message which is used to transfer large amounts of actions at once. /// </summary> /// <param name="props">Properties.</param> public void ClaimObjectBulkMessage(Dictionary<string, object> props) { int numObjects = (int)props["numObjects"]; AtavismLogger.LogDebugMessage("Got numObjects: " + numObjects); for (int i = 0; i < numObjects; i++) { string actionString = (string)props["object_" + i]; string[] actionData = actionString.Split(';'); string objectID = actionData[0]; string claimID = actionData[1]; string gameObject = actionData[2]; string[] locData = actionData[3].Split(','); Vector3 loc = new Vector3(float.Parse(locData[0]), float.Parse(locData[1]), float.Parse(locData[2])); string[] normalData = actionData[4].Split(','); Quaternion orient = new Quaternion(float.Parse(normalData[0]), float.Parse(normalData[1]), float.Parse(normalData[2]), float.Parse(normalData[3])); string state = actionData[5]; //SpawnClaimObject(int.Parse(objectID), int.Parse(claimID), gameObject, loc, orient); ClaimObjectData objectData = new ClaimObjectData(); objectData.objectID = int.Parse(objectID); objectData.claimID = int.Parse(claimID); objectData.prefabName = gameObject; objectData.loc = loc; objectData.orient = orient; objectData.state = state; objectsToLoad.Add(objectData); } }