/// <summary> /// Add regular game view on scene /// </summary> /// <param name="game"></param> public void AddRegularGameView(BaseRegularGame game) { var regularRoom = (GameObject)Instantiate( Resources.Load("Prefabs/RegularRoom", typeof(GameObject)), new Vector2(), Quaternion.identity, transform ); regularRoom.GetComponent <RegularRoomView>().Game = game; regularRoom.GetComponent <RegularRoomView>().ServerUpdateRegularGameSignal = ServerUpdateRegularGameSignal; }
/// <summary> /// Update regular game view /// </summary> /// <param name="game"></param> public void UpdateRegularGameView(BaseRegularGame game) { foreach (Transform child in transform) { if (child.GetComponent <RegularRoomView>() == null || child.GetComponent <RegularRoomView>().Game.Id != game.Id) { continue; } child.GetComponent <RegularRoomView>().Game = game; child.GetComponent <RegularRoomView>().InitGame(); } Debug.Log("UpdateRegularGameView " + game.Id); }