private void OnNpcNameEntered(TextInputArgs e) { Main.TextInputBox.OnInputEntered -= OnNpcNameEntered; string npcName = e.Input.ToLower(); GameWorld.Instance.WorldData.MetaData[_sourceTileIndex] = "npc:" + npcName; CreateNpc(npcName); }
private void RenameButton_OnInputEntered(TextInputArgs e) { DataFolder.RenameFile(_selectedLevel.FilePath, _selectedLevel.Name, e.Input); Main.TextInputBox.OnInputEntered -= RenameButton_OnInputEntered; LoadLevels(); }
/// <summary> /// Checks if level exists and creates links. /// </summary> /// <param name="e"></param> private void OnLevelNameEntered(TextInputArgs e) { // If the input has an index to teleport to, then include it. if (e.Input.Contains("/")) { string[] data = e.Input.Split('/'); _linkedLevelName = data[0]; _linkedPortalIndex = data[1]; } else { _linkedLevelName = e.Input; _linkedPortalIndex = null; } if (DataFolder.LevelExists(_linkedLevelName)) { GameWorld.Instance.WorldData.MetaData[_tileIndex] = "pl:nl:" + e.Input; Main.TextInputBox.OnInputEntered -= OnLevelNameEntered; string message = "Portal link created to level: " + _linkedLevelName + " on index: " + (_linkedPortalIndex ?? "SPAWN") + ". This portal index is: " + _tileIndex; Main.MessageBox.Show(message); Console.WriteLine(message); } else { Main.MessageBox.Show("Level does not exist. Try again."); Main.TextInputBox.ShowSameMessage(); } }
private void NewLevel_OnTextEntered(TextInputArgs e) { string newPath; Main.TextInputBox.OnInputEntered -= NewLevel_OnTextEntered; try { newPath = DataFolder.CreateNewLevel(e.Input, 256, 256); } catch (Exception ex) { Main.MessageBox.Show(ex.Message); return; } DataFolder.EditLevel(newPath); }