void UpdateState(string json) { //Debug.Log("Updating State: "+service + "\r\n"+json); this.state = (T)Activator.CreateInstance(typeof(T)); this.state = (T)state.FromJson(json); WTEvents.PublishEvent(this.state.defaultEvent, new WTEvent(this.state)); }
// Update is called once per frame void Start() { this.InstantiatePlayer(); this.InstantiateAirfieldQueue(); this.InstantiateMapObjectiveQueue(); this.mapMaterial = Instantiate(groundRenderer.sharedMaterial); groundRenderer.sharedMaterial = this.mapMaterial; WTEvents.RegisterEventHandler(WTEvent.Type.mapImageChange, UpdateMapTexture); WTEvents.RegisterEventHandler(WTEvent.Type.mapObjectsChange, this.HandleMapObjectStateChange); WTEvents.RegisterEventHandler(WTEvent.Type.gameLoad, this.InstantiateAirfieldQueue); }
void Start() { WTEvents.RegisterEventHandler(WTEvent.Type.indicatorsStateChange, this.HandleIndicatorsChange); }
void UpdateImage(Texture2D image, byte[] data) { this.image = new Texture2D(image.width, image.height); this.image.LoadImage(data, false); WTEvents.PublishEvent(updateEvent, new WTEvent(this.image)); }