IEnumerator SignUpRoutine()
    {
        string username = loginInput.text;
        string password = passInput.text;
        string nick     = nickInput.text;

        //checar se user ja existe
        int asyncId = Fabio.GetAsyncId();

        Fabio.god.rest.GetUserByUsername(username, asyncId);
        yield return(new WaitUntil(() => Fabio.CheckAsyncId(asyncId)));

        User user = Fabio.god.rest.user;

        if (user != null)
        {
            print("Username taken");
            //TRATAR
        }
        else
        {
            user               = new User();
            user.login         = username;
            user.user_password = password;
            user.nick          = nick;
            user.join_date     = System.DateTime.Today;
            user.last_login    = System.DateTime.Today;
            user.active        = 1;
            user.banned        = 0;
            user.money_spent   = 0;

            Fabio.god.rest.AddUser(user);
            Fabio.LoadScene("Login");
        }
    }
示例#2
0
    IEnumerator CreateCharacter(Character newCharacter)
    {
        Fabio.god.rest.AddCharacter(newCharacter);
        yield return(new WaitForSeconds(0.1f)); //wait a little then reload to show new char

        Fabio.LoadScene("Characters");
    }
示例#3
0
    IEnumerator DeleteItemRoutine(int id)
    {
        print("deleting" + slots[id].GetComponent <InvSlot>().myItem.item_id);
        Fabio.god.rest.DeleteItem(slots[id].GetComponent <InvSlot>().myItem.item_id);
        yield return(new WaitForSeconds(0.1f));

        Fabio.LoadScene("Inv");
    }
示例#4
0
    public void EquipWeapon(int id)
    {
        Character character = charactersScreens[id].GetComponent <CharScreen>().myCharacter;

        Fabio.god.Equipchar  = character;
        Fabio.god.equipArmor = false;
        Fabio.LoadScene("EquipItem");
    }
示例#5
0
 public void Equip(int id)
 {
     if (!equiping)
     {
         equiping = true;
         int newitemid = slots[id].GetComponent <InvSlot>().myItem.item_id;
         Fabio.god.rest.EquipItem(newitemid, Fabio.god.Equipchar, Fabio.god.equipArmor);
         Fabio.LoadScene("MainMenu");
     }
 }
 public void Trade(int id)
 {
     if (!trading)
     {
         trading            = true;
         Fabio.god.tradeid2 = slots[id].GetComponent <InvSlot>().myItem.item_id;
         Fabio.god.rest.TradeItem(Fabio.god.tradeid1, Fabio.god.tradeid2, Fabio.user.login, Fabio.god.tradeUser.login);
         Fabio.LoadScene("MainMenu");
     }
 }
示例#7
0
    IEnumerator DeleteCharacterRoutine(Character character)
    {
        if (character.armor != null)
        {
            StartCoroutine(Fabio.god.rest.ChangeItemStatus(character.armor, 0));
        }
        if (character.weapon != null)
        {
            StartCoroutine(Fabio.god.rest.ChangeItemStatus(character.weapon, 0));
        }

        Fabio.god.rest.DeleteCharacter(character.character_id);

        yield return(new WaitForSeconds(0.1f)); //wait a little then reload to show new spot

        Fabio.LoadScene("Characters");
    }
示例#8
0
    IEnumerator SignInRoutine()
    {
        string username = userInput.text;
        string password = passInput.text;

        int asyncId = Fabio.GetAsyncId();

        Fabio.god.rest.GetUserByUsername(username, asyncId);
        print("signing " + username);
        yield return(new WaitUntil(() => Fabio.CheckAsyncId(asyncId)));

        print("fetched");

        User user = Fabio.god.rest.user;

        if (user == null)
        {
            print("usuario n existe");
            //Tratar
        }
        else
        {
            if (CheckPassword(user.user_password, password))
            {
                if (user.banned != 0)
                {
                    print("Usuario banido!");
                }
                else
                {
                    Fabio.god.rest.UpdateUserLastLogin(username);
                    print("updating login: "******"fetched");
                    print("LOGIN FOI");
                    Fabio.user = user;
                    Fabio.LoadScene("MainMenu");
                }
            }
            else
            {
                print("Senha invalida");
                //Tratar
            }
        }
    }
    IEnumerator ActionRoutine()
    {
        User originalUser = Fabio.god.rest.user;

        int asyncId = Fabio.GetAsyncId();

        Fabio.god.rest.GetUserByUsername(searchBar.text, asyncId);
        yield return(new WaitUntil(() => Fabio.CheckAsyncId(asyncId)));

        print("fetched");
        Fabio.god.tradeUser = Fabio.god.rest.user;
        Fabio.god.rest.user = originalUser;

        if (Fabio.god.tradeUser == null)
        {
            print("User not found");
        }
        else
        {
            Fabio.LoadScene("Trade2");
        }
    }
示例#10
0
 public void returnFunc(string scene)
 {
     Fabio.LoadScene(scene);
 }
示例#11
0
 public void Trade(int id)
 {
     Fabio.god.tradeid1 = slots[id].GetComponent <InvSlot>().myItem.item_id;
     Fabio.LoadScene("Trade1");
 }
示例#12
0
 public void signUp()
 {
     Fabio.LoadScene("Register");
 }