예제 #1
0
 public void GoToLevel(string lvl)
 {
     PlayerCononectMySql.LoadCharacterData(_allStuffID);
     PlayerCononectMySql.GetStatusForCharacter(PlayerCononectMySql._connection, _allStuffID);
     PlayerCononectMySql._connection.Close();
     SceneManager.LoadScene(lvl);//"SkyFall Arena(2)"
 }
예제 #2
0
    private void GetCharacterStast(int ID)
    {
        PlayerCononectMySql.GetStatusForCharacter(PlayerCononectMySql._connection, ID);

        for (int cnt = 0; cnt < _status.Length; cnt++)
        {
            _status[cnt] = PlayerCononectMySql._status[cnt];
        }
    }
예제 #3
0
    public void CreatChar()
    {
        PlayerCononectMySql.ConectBd(PlayerCononectMySql._source);

        _pointsLeft = (STARTING_VALUE - MIN_STARTING_ATTRIBUTES_VALUE);
        InstantiateCharacterModel();
        SelectPanel.SetActive(false);
        Creatpanel.SetActive(true);
    }
예제 #4
0
    //Seleciona o Personagem
    public void SelectCharButton(CharSelectBut selct)
    {
        PlayerCononectMySql.ConectBd(PlayerCononectMySql._source);

        //Desativa menus especifico
        PlayerMenus.SetActive(true);
        OverallData.SetActive(true);
        StastGeneral.SetActive(false);
        GeneralStastValues(selct.Index);
        SelectPanel.SetActive(false);
        ChatPanel.SetActive(true);

        //localiza botão status e aferi um index de seleção
        GameObject.Find("Stast").GetComponent <StastButton>().Index = selct.Index;
        //localiza botão da arena e aferi um index de seleção
        GameObject.Find("Select Area to go").GetComponent <StastButton>().Index = selct.Index;
        //localiza botão da arena e aferi um ID ao personagem
        GameObject.Find("Select Area to go").GetComponent <StastButton>().ID = selct.charID;
        //Coloca index referentes(ta bem descritivo)
        _allStuffID   = selct.Index;
        _name.text    = selct._Name.text;
        lvl.text      = selct.Level.text;
        _butIndex     = selct.Index;
        Generalindex  = selct.Index;
        GeneralGender = selct._gender;

        //passa valores ao Data Worker e nele q os dados do personagem são levados para outra cena
        DW._name      = selct._Name.text;
        DW._gender    = selct._gender;
        DW._id        = selct.charID;
        DW._hair      = selct._hair;
        DW._hairColor = selct._hairColor;
        DW._eyesColor = selct._eyesColor;

        //character itens on DW
        DW.chest      = selct.chest;
        DW.hands      = selct.hands;
        DW.WeaponMain = selct.WeaponMain;
        DW.Legs       = selct.Legs;
        DW.Boots      = selct.Boots;
        DW.WeaponOff  = selct.WeaponOff;

        //Pegas os dados de status do personagem
        GetCharacterStast(selct.charID);

        //Potons do stats do personagem
        if (selct.needpoints)
        {
            FirstPointsToAdd(selct.Index);
        }
    }
예제 #5
0
    public void BackButton()
    {
        OverallData.SetActive(false);
        StastGeneral.SetActive(false);
        StastToAllowcateInCreat.SetActive(false);
        PlayerMenus.SetActive(false);
        SelectPanel.SetActive(true);
        AreaToGo.SetActive(false);
        ArenaPanell.SetActive(false);
        BgPanell.SetActive(false);
        ChatPanel.SetActive(false);
        ConfigurationsPanel.SetActive(false);
        InventoryGrp.SetActive(false);
        changeItens = false;

        PlayerCononectMySql.UpdateItensForCharacter(PlayerCononectMySql._connection, DW._id, DW.chest, DW.hands, DW.WeaponMain,
                                                    DW.Legs, DW.Boots, DW.WeaponOff);

        PlayerCononectMySql._connection.Close();
        PlayerCononectMySql._connection.Dispose();
    }
예제 #6
0
    public void CreatCharacter()
    {
        PlayerCononectMySql.ConectBd(PlayerCononectMySql._source);

        _charID         = UnityEngine.Random.Range(1, 100);
        _charName       = newName.text;
        pointsLeft.text = "Points Left :" + _pointsLeft.ToString();

        bool validi = PlayerCononectMySql.VerifyData(PlayerCononectMySql._connection, _charID, _charName);

        if (!validi)
        {
            _charSlot++;
            _charCount++;
            SaveCreatedNewCharacter();

            //destroi pre personagem criado
            if (transform.childCount != 0)
            {
                for (int cnt = 0; cnt < transform.childCount; cnt++)
                {
                    Destroy(transform.GetChild(cnt).gameObject);
                }
            }

            _characterCreated = true;

            SelectPanel.SetActive(true);
            Creatpanel.SetActive(false);
            StastToAllowcateInCreat.SetActive(false);

            //instancia o personagem na lista
            CharCreatInstance(_charSlot);
        }
        else
        {
            _charID   = UnityEngine.Random.Range(1, 100);
            _charName = string.Empty;
        }
    }
예제 #7
0
    private void SaveCreatedNewCharacter()
    {
        _charSlot = _charCount - 1;
        PlayerCononectMySql.SendNewCharacterToBd(PlayerCononectMySql._connection,
                                                 _charOwner, _charID, _charName,
                                                 _startLvl, 0, _charSlot, _gender,
                                                 _hair.hairMechIndex,
                                                 _hair.hairColorIndex,
                                                 _eyes.eyesMechIndex,
                                                 _eyes.eyesColorIndex);

        PlayerCononectMySql.UpdateOwnerInfo(PlayerCononectMySql._connection, _charCount, _charOwner);

        PlayerCononectMySql.SendStatusForCharacter(PlayerCononectMySql._connection, _charID, _charlvlup, _status[0],
                                                   _status[1], _status[2], _status[3], _status[4], _status[5], _status[6],
                                                   _status[7], _status[8], _status[9], _status[10], _status[11],
                                                   _status[12]);


        PlayerCononectMySql._connection.Close();
        PlayerCononectMySql._connection.Dispose();
    }
예제 #8
0
    private void CharCreatInstance(int charslot)
    {
        if (_charCount == 4)
        {
            CreatButton.SetActive(false);
        }

        if (_characterCreated)
        {
            //Debug.Log(charslot);
            PlayerCononectMySql.LoadCharacterData(charslot);
            InstantiateAllCharacter(charslot, _charID, slots[charslot]);
            _charName = PlayerCononectMySql._charName;
            _charID   = PlayerCononectMySql._charID;
            CharSelect[charslot].gameObject.SetActive(true);
            CharSelect[charslot].gameObject.GetComponent <CharSelectBut>()._Name.text = "Name :" + _charName;
            CharSelect[charslot].gameObject.GetComponent <CharSelectBut>().Level.text = "Level :" + _startLvl;
            CharSelect[charslot].gameObject.GetComponent <CharSelectBut>().charID     = _charID;
            CharSelect[charslot].gameObject.GetComponent <CharSelectBut>().Index      = charslot;
            _needToAddPoints = true;
            CharSelect[charslot].gameObject.GetComponent <CharSelectBut>().needpoints = _needToAddPoints;
        }
    }
예제 #9
0
    void Start()
    {
        database = GameObject.FindGameObjectWithTag("ItemDatabase").GetComponent <ItemDatabase>();
        DW       = GameObject.FindGameObjectWithTag("DataWorker").GetComponent <DataWorker>();

        if (GameSettings2.maleModels.Length < 1)
        {
            Debug.LogWarning("We have no male Models");
        }

        if (GameSettings2.femaleModels.Length < 1)
        {
            Debug.LogWarning("We have no female Models");
        }


        PlayerCononectMySql.InitateConection();

        _charCount = PlayerCononectMySql._charCount;
        _charOwner = PlayerCononectMySql._ownerChar;
        _charSlot  = PlayerCononectMySql._charSlot;

        if (PlayerCononectMySql._charName != null)
        {
            _charName = PlayerCononectMySql._charName;
        }

        if (_charCount == 4)
        {
            CreatButton.SetActive(false);
        }

        if (_charCount > 0 && _charCount <= 4)
        {
            for (int i = 0; i <= _charCount - 1; i++)
            {
                PlayerCononectMySql.LoadCharacterData(i);
                _charID      = PlayerCononectMySql._charID;
                _charName    = PlayerCononectMySql._charName;
                _currlvl     = PlayerCononectMySql._charLvl;
                _myGender    = PlayerCononectMySql._gender;
                _myHair      = PlayerCononectMySql._hairMesh;
                _myHairColor = PlayerCononectMySql._hairColor;
                _myEyesColor = PlayerCononectMySql._eyesColor;

                InstantiateAllCharacter(i, _charID, slots[i]);

                chest      = PlayerCononectMySql._itensEquiped[1];
                hands      = PlayerCononectMySql._itensEquiped[2];
                WeaponMain = PlayerCononectMySql._itensEquiped[4];
                Legs       = PlayerCononectMySql._itensEquiped[3];
                Boots      = PlayerCononectMySql._itensEquiped[0];
                WeaponOff  = PlayerCononectMySql._itensEquiped[5];

                AddCharacterItens(_myGender, i, chest, hands, WeaponMain, Legs, Boots, WeaponOff);

                if (slots[i].transform.childCount != 0)
                {
                    //Char Base
                    CharSelect[i].gameObject.GetComponent <CharSelectBut>()._Name.text = "Name :" + _charName;
                    CharSelect[i].gameObject.GetComponent <CharSelectBut>().Level.text = "level :" + _currlvl;
                    CharSelect[i].gameObject.GetComponent <CharSelectBut>().charID     = _charID;
                    CharSelect[i].gameObject.GetComponent <CharSelectBut>().Index      = i;
                    CharSelect[i].gameObject.GetComponent <CharSelectBut>()._gender    = _myGender;
                    CharSelect[i].gameObject.GetComponent <CharSelectBut>()._hair      = _myHair;
                    CharSelect[i].gameObject.GetComponent <CharSelectBut>()._hairColor = _myHairColor;
                    CharSelect[i].gameObject.GetComponent <CharSelectBut>()._eyesColor = _myEyesColor;
                    CharSelect[i].gameObject.GetComponent <CharSelectBut>().needpoints = _needToAddPoints;

                    //Char Itens
                    CharSelect[i].gameObject.GetComponent <CharSelectBut>().chest      = chest;
                    CharSelect[i].gameObject.GetComponent <CharSelectBut>().hands      = hands;
                    CharSelect[i].gameObject.GetComponent <CharSelectBut>().WeaponMain = WeaponMain;
                    CharSelect[i].gameObject.GetComponent <CharSelectBut>().Legs       = Legs;
                    CharSelect[i].gameObject.GetComponent <CharSelectBut>().Boots      = Boots;
                    CharSelect[i].gameObject.GetComponent <CharSelectBut>().WeaponOff  = WeaponOff;
                }
            }

            for (int i = 0; i <= 3; i++)
            {
                if (CharSelect[i].gameObject.GetComponent <CharSelectBut>().charID == 0)
                {
                    CharSelect[i].gameObject.SetActive(false);
                }
            }
        }

        PlayerCononectMySql._connection.Close();
        PlayerCononectMySql._connection.Dispose();
    }
예제 #10
0
 void Awake()
 {
     PlayerCononectMySql.ConectBd(PlayerCononectMySql._source);
 }