Ejemplo n.º 1
0
    public void OnRoomNameTextEndEdit()
    {
        string newName = tif_roomName.text;

        // MAY rename!
        if (RoomSaverLoader.MayRenameRoomFile(room, newName))
        {
            // Rename the room file, and reload all RoomDatas!
            RoomSaverLoader.RenameRoomFile(room, newName);
            dataManager.ReloadWorldDatas();
            // Save that this is the most recent room we've been to!
            SaveStorage.SetString(SaveKeys.LastPlayedRoomKey(room.WorldIndex), newName);
            dataManager.currRoomData = dataManager.GetRoomData(room.WorldIndex, room.RoomKey, false);
            // Reload the scene for safety.
            SceneHelper.ReloadScene();
        }
        // May NOT rename.
        else
        {
            ResetRoomNameText();
        }
    }
Ejemplo n.º 2
0
    public void OnRoomNameTextChanged()
    {
        // Change color if there's a naming conflict!
        string newName = tif_roomName.text;
        Color  color;

        if (newName == room.RoomKey)
        {
            color = new Color(0, 0, 0, 0.4f);
        }                                                                // Same name? Black.
        else if (RoomSaverLoader.MayRenameRoomFile(room, newName))
        {
            color = new Color(130 / 255f, 160 / 255f, 40 / 255f);
        }                                                                                                             // Can rename? Green!
        else
        {
            color = new Color(140 / 255f, 55 / 255f, 40 / 255f);
        }                                                       // CAN'T rename? Red.
        // Apply the color.
        foreach (TextMeshProUGUI t in tif_roomName.GetComponentsInChildren <TextMeshProUGUI>())
        {
            t.color = color;
        }
    }