public override void Process(NetMessage msg) { Logger.LogTraceFormat("Processed {0}", Category.NetUI, this); LoadNetworkObject(msg.Provider); //If start or middle of message add to cache then stop if (msg.ID == TabMessageType.MoreIncoming) { //If Unique Id doesnt exist make new entry if (ElementValuesCache.Count == 0 || !ElementValuesCache.ContainsKey(msg.UniqueID)) { ElementValuesCache.Add(msg.UniqueID, new Tuple<ElementValue[], int>(msg.ElementValues, 1)); return; } //Sanity check to make sure this isnt the last message if (msg.NumOfMessages == ElementValuesCache[msg.UniqueID].Item2 + 1) { Logger.LogError("This message didnt arrive in time before the end message!", Category.NetUI); ElementValuesCache.Remove(msg.UniqueID); return; } //Unique Id already exists so add arrays to each other ElementValuesCache[msg.UniqueID] = new Tuple<ElementValue[], int>(Concat(ElementValuesCache[msg.UniqueID].Item1, msg.ElementValues), ElementValuesCache[msg.UniqueID].Item2 + 1); return; } //If end of message add and continue if(msg.ID == TabMessageType.EndOfMessage) { //Add the arrays together ElementValuesCache[msg.UniqueID] = new Tuple<ElementValue[], int>(Concat(ElementValuesCache[msg.UniqueID].Item1, msg.ElementValues), ElementValuesCache[msg.UniqueID].Item2 + 1); //Check to make sure its the last message if (msg.NumOfMessages != ElementValuesCache[msg.UniqueID].Item2) { Logger.LogError("Not all the messages arrived in time for the NetUI update.", Category.NetUI); return; } msg.ElementValues = ElementValuesCache[msg.UniqueID].Item1; ElementValuesCache.Remove(msg.UniqueID); } switch (msg.Action) { case TabAction.Open: ControlTabs.ShowTab(msg.Type, NetworkObject, msg.ElementValues); break; case TabAction.Close: ControlTabs.CloseTab(msg.Type, NetworkObject); break; case TabAction.Update: ControlTabs.UpdateTab(msg.Type, NetworkObject, msg.ElementValues, msg.Touched); break; } }
public override void Process() { Logger.LogTraceFormat("Processed {0}", Category.NetUI, this); LoadNetworkObject(Provider); switch (Action) { case TabAction.Open: ControlTabs.ShowTab(Type, NetworkObject, ElementValues); break; case TabAction.Close: ControlTabs.CloseTab(Type, NetworkObject); break; case TabAction.Update: ControlTabs.UpdateTab(Type, NetworkObject, ElementValues, Touched); break; } }
public override IEnumerator Process() { Logger.LogTraceFormat("Processed {0}", Category.NetUI, this); yield return(WaitFor(Provider)); switch (Action) { case TabAction.Open: ControlTabs.ShowTab(Type, NetworkObject, ElementValues); break; case TabAction.Close: ControlTabs.CloseTab(Type, NetworkObject); break; case TabAction.Update: ControlTabs.UpdateTab(Type, NetworkObject, ElementValues, Touched); break; } }
public override IEnumerator Process() { // Logger.Log("Processed " + ToString()); yield return(WaitFor(Provider)); switch (Action) { case TabAction.Open: ControlTabs.ShowTab(Type, NetworkObject, ElementValues); break; case TabAction.Close: ControlTabs.CloseTab(Type, NetworkObject); break; case TabAction.Update: ControlTabs.UpdateTab(Type, NetworkObject, ElementValues, Touched); break; } }