public MainHub(MainGame tempGame) : base("Sprites/MainHub.png", 32, 24, "Sprites/MainHub.png", 32, 24, "colors.png", 1, 1, tempGame) { FileName = @"Screens/MainHub/MainHub.tmx"; Map _levelData = MapParser.ReadMap(FileName); SpawnCollisionTiles(_levelData); SpawnBackgroundTiles(_levelData, true); SpawnObjects(_levelData); SpawnOverlapTiles(_levelData); _game = tempGame; _displayTut = _game.DisplayTutorial; _tickets = new TicketDisplay(_game); AddChild(_tickets); _clock = new Clock(); AddChild(_clock); if (_displayTut) { _c = new ConversationBox("Text/Tutorial.txt", this); AddChild(_c); } FirstInstance = false; _shopKeeper = new ShopKeeper(); AddChild(_shopKeeper); }
/// <summary> /// Write string to conversationBox textbox, this method can be used by different threads to write on conversationBox textbox /// </summary> /// <param name="Msg"> /// string to write in conversationBox textbox /// </param> private void SetText(string Msg) { if (this.ConversationBox.InvokeRequired)//check if caller Id is different from creator id { SetTextCallBack setText = new SetTextCallBack(SetText); Invoke(setText, Msg);//call delegate from creator thread } else//if method called from creator thread { ConversationBox.AppendText(Msg + "\r\n"); } }
public void DeleteTut() { _game.DisplayTutorial = false; _c.LateDestroy(); _c = null; }