コード例 #1
0
    public static async Task <RegisterAccountResponse> TryToRegister()
    {
        var username   = Object.usernameInputField.GetValue();
        var playerName = Object.playerNameInputField.GetValue();
        var password   = Object.passwordInputField.GetValue();

        LOG.Log($"Trying to register with: {username} | {password} | {playerName}");

        var res = await NetworkService.Register(username, password, playerName);

        string message = "";

        switch (res.response)
        {
        case RegisterAccountResponseType.Success:
            message = $"Registration was ok!";
            break;

        case RegisterAccountResponseType.UserNameAlreadyExists:
            message = $"Username already exists";
            break;

        case RegisterAccountResponseType.PlayerNameAlreadyExists:
            message = $"Player name already exists";
            break;
        }

        LOG.Log(message);
        UIEvents.ChangeGameText(GameTextId.RegisterResponse, message);

        return(res);
    }
コード例 #2
0
    public override async Task OnClick()
    {
        try {
            await GameState.SetCurrentWorldByWorldIndex(WorldIndex);

            UIEvents.ChangeGameText(GameTextId.WorldName, GameState.CurrentWorld.World.Name);

            var character = GameState.GetCharacterByWorldId(GameState.CurrentWorld.World.Id);

            if (character == null)
            {
                LOG.Log($"Player does not have a character on world: {GameState.CurrentWorld.World.Id}");
                await ScreenChangerService.ChangeScreen(ScreenId.CreateCharacter);
            }
            else
            {
                LOG.Log($"Found Character!");
                GameState.CurrentCharacter = character;
                await ScreenChangerService.ChangeScreen(ScreenId.SelectCharacter);
            }
        }
        catch (System.Exception e) {
            LOG.Log(e);
            throw;
        }
    }
コード例 #3
0
 private static void SetZaiMessage()
 {
     if (!GameState.HasAnyCharacterType)
     {
         UIEvents.ChangeGameText(GameTextId.ZaiChat, "You don't have a Spirit Warrior on your vessel... Come and talk to me.");
     }
 }
コード例 #4
0
 public override Task OnClick()
 {
     try {
         LOG.Log($"Selecting character {type}");
         CharacterCreationScreenRefresherService.SetHasCharacterTypeSelected(true);
         CharacterCreationScreenRefresherService.SetSelectedCharacterType(type);
         UIEvents.ChangeGameText(GameTextId.SelectedCharacterType, type.ToString());
         return(base.OnClick());
     }
     catch (System.Exception e) {
         LOG.Log(e);
         throw;
     }
 }
コード例 #5
0
    public static void Refresh()
    {
        Object.hasCharacterTypeSelected = false;
        UIEvents.ChangeGameText(GameTextId.SelectedCharacterType, "No Char Selected");

        for (int i = 0; i < Object.container.childCount; i++)
        {
            Destroy(Object.container.GetChild(i).gameObject);
        }

        foreach (var character in GameState.PlayerData.AvailableCharacters)
        {
            GameObject obj = Instantiate(Object.buttonPrefab, Object.container);
            obj.GetComponent <SelectCharacterTypeButton>().Setup(character);
        }
    }
コード例 #6
0
    private void RefreshQuestList(QuestStatus status)
    {
        LOG.Log($"Refreshing quest screen with status: {status}");
        UIEvents.ChangeGameText(GameTextId.SelectedQuestStatus, $"{status} quests");
        ShowQuestList();

        Object.status = status;

        Object.questListScrollView.Clear();

        var filteredQuestList = GameState.QuestList.FindAll(x => x.Status == status);

        foreach (var quest in filteredQuestList)
        {
            Object.CreateQuestButton(quest);
        }
    }
コード例 #7
0
    private async Task ConnectToServer()
    {
        UIEvents.ChangeGameText(GameTextId.IsConnectedToServer, "Not Connected to the server");

        while (!connected && Application.isPlaying)
        {
            connected = await NetworkService.ConnectToServer();

            if (connected)
            {
                UIEvents.ChangeGameText(GameTextId.IsConnectedToServer, "Connected to the server");
            }
            else
            {
                UIEvents.ChangeGameText(GameTextId.IsConnectedToServer, "Not Connected to the server");
                LOG.Log("Failed to connect to server. Waiting 3 seconds and trying again");
                await Task.Delay(3000);
            }
        }
    }
コード例 #8
0
    public static void SyncArea(AreaSyncData data)
    {
        UIEvents.ChangeGameText(GameTextId.AreaName, data.Area.Name);

        SyncBattleground(data);
    }
コード例 #9
0
 public static void Refresh()
 {
     UIEvents.ChangeGameText(GameTextId.PlayerName, GameState.PlayerData.PlayerName);
     UIEvents.ChangeGameText(GameTextId.UniverseName, GameState.Universe.Name);
 }
コード例 #10
0
 public async Task Refresh()
 {
     UIEvents.ChangeGameText(GameTextId.WorldName, GameState.CurrentWorld.World.Name);
     await NetworkService.RequestWorldSyncData(GameState.CurrentWorld.World.Id);
 }