public void RestoreToState() { if (objectState != null && objectState.StateIsSaved()) { List <object> variables = objectState.GetVariables(); SortedDictionary <string, ReceiveBase> messageHandlerCopy = new SortedDictionary <string, ReceiveBase>((SortedDictionary <string, ReceiveBase>)variables[2]); SortedList prefixListCopy = new SortedList((SortedList)variables[3]); State.receive_buffer = new byte[State.BufSize]; isAlive = (bool)variables[0]; objectLoadSceneLock = variables[1]; messageHandler = messageHandlerCopy; // prefixList = prefixListCopy; // maxPlayers = (int)variables[4]; messageIsSend = (bool)variables[5]; gameStarted = (bool)variables[6]; this.timer = (int)variables[7]; this.id = (int)variables[8]; this.state = new State(); // make copy (State)variables[9]; this.timeIsPassed = (float)variables[10]; this.timePassedTrying = (float)variables[11]; this.bytesLen = (int)variables[12]; this.spawnId = (int)variables[13]; this.serverIp = (string)variables[14]; this.isDisconnected = (bool)variables[15]; this.connectionThreadJoin = (bool)variables[16]; } }
public void RestoreToState() { if (state != null && state.StateIsSaved()) { List <object> variables = state.GetVariables(); actionToExecuteOnMainThread = (bool)variables[0]; Setup(); } }
public void RestoreToState() { if (state != null && state.StateIsSaved()) { List <object> variables = state.GetVariables(); this.prefix = (string)variables[0]; this.scriptEnabled = (bool)variables[1]; } }
public void RestoreToState() { if (state != null && state.StateIsSaved()) { List <object> variables = state.GetVariables(); Dictionary <string, ReceiveBase> copyMessageHandler = new Dictionary <string, ReceiveBase>((Dictionary <string, ReceiveBase>)variables[0]); Dictionary <string, ReceiveBase> copyMessageHandlerForBoth = new Dictionary <string, ReceiveBase>((Dictionary <string, ReceiveBase>)variables[1]); this.messageHandler = copyMessageHandler; this.messageHandlerForBoth = copyMessageHandlerForBoth; this.reset = (bool)variables[2]; this.isAlive = (bool)variables[3]; } }
public void RestoreToState() { if (state != null && state.StateIsSaved()) { List <object> variables = state.GetVariables(); SortedList coping = (SortedList)variables[0]; SortedList copy = new SortedList(coping); messages = copy; scriptEnabled = (bool)variables[1]; prefix = (string)variables[2]; packageIndex = (int)variables[3]; if (!UDPConnectionManager.CheckIfPrefixExist(prefix)) { UDPConnectionManager.AddPrefix(prefix); } UDPConnectionManager.AddToMessageHandler(prefix, this); } }
public void RestoreToState() { if (state != null && state.StateIsSaved()) { List <object> variables = state.GetVariables(); if (playerById != null && playerById.Count > 0) { for (int i = 0; i < playerById.Keys.Count; i++) { if (playerById != null && playerById.Values.ElementAt(i) != null && playerById.Values.ElementAt(i).gameObject != null) { Destroy(playerById.Values.ElementAt(i).gameObject); } } } if (freePlayerManagers != null && freePlayerManagers.Count > 0) { for (int i = 0; i < freePlayerManagers.Count; i++) { if (freePlayerManagers != null && freePlayerManagers[i] != null && freePlayerManagers[i].gameObject != null) { Destroy(freePlayerManagers[i].gameObject); } } } Dictionary <string, UDPPlayer> playerByIdCopy = new Dictionary <string, UDPPlayer>((Dictionary <string, UDPPlayer>)variables[1]); List <UDPPlayer> freePlayerManagersCopy = new List <UDPPlayer>((List <UDPPlayer>)variables[2]); List <string> playersIDCopy = new List <string>((List <string>)variables[3]); playerPrefabRef = (GameObject)variables[0]; playerById = playerByIdCopy; // freePlayerManagers = freePlayerManagersCopy; // playersID = playersIDCopy; // playerCreated = (bool)variables[4]; } }