Example #1
0
    public void ButtonCreateCharacter()
    {
        UICreateCharacter ui = panelNewCharacters.GetComponent <UICreateCharacter>();

        if (ui.avatarName.text.Length >= 4)
        {
            ClientSocketScript css = GameManager.instance.GetComponent <ClientSocketScript>();
            css.Send(
                PacketHandler.newPacket(
                    PacketHandler.PacketID_AccountCharacterCreate,
                    ui.avatarName.text,
                    ui.body,
                    ColorUtility.ToHtmlStringRGB(ui.bodyColor),
                    ui.eye,
                    ui.frontHair,
                    ui.rearHair,
                    ColorUtility.ToHtmlStringRGB(ui.hairColor)
                    )
                );
        }
        else
        {
            UICanvasPopup.instance.AddPopup("Warning", "Le nom de votre personnage est trop court (4 caracteres minimal).");
        }
    }
Example #2
0
 public void OnPointerUp(PointerEventData eventData)
 {
     if (_selectedItem.item != null)
     {
         UIItem pointed = UIInventory.instance.PointedSlot();
         if (pointed != null && pointed.slot != slot)
         {
             ClientSocketScript css = GameManager.instance.GetComponent <ClientSocketScript>();
             css.Send(
                 PacketHandler.newPacket(PacketHandler.PacketID_MoveItem,
                                         _selectedItem.item.slot,
                                         pointed.slot
                                         )
                 );
             UIInventory.instance.inventory.SwapItem(_selectedItem.item.slot, pointed.slot);
             UpdateItem(pointed.item);
             pointed.UpdateItem(_selectedItem.item);
         }
         else
         {
             UpdateItem(_selectedItem.item);
         }
         _selectedItem.UpdateItem(null);
     }
 }
Example #3
0
    public void ButtonRegister()
    {
        if (!IsConnected())
        {
            if (UICanvasPopup.instance)
            {
                UICanvasPopup.instance.AddPopup("Error", "Vous n'etes pas connecter au serveur.");
            }
            return;
        }
        InputField login      = GameObject.Find("InputFieldRegisterLogin").GetComponent <InputField>();
        InputField pwd        = GameObject.Find("InputFieldRegisterPassword").GetComponent <InputField>();
        InputField pwdConfirm = GameObject.Find("InputFieldRegisterPasswordConfirm").GetComponent <InputField>();

        if (login.text.Length >= 4)
        {
            if (pwd.text.Length >= 6)
            {
                if (pwd.text == pwdConfirm.text)
                {
                    ClientSocketScript css = GameManager.instance.GetComponent <ClientSocketScript>();
                    css.Send(
                        PacketHandler.newPacket(PacketHandler.PacketID_Register,
                                                login.text,
                                                pwd.text
                                                )
                        );
                }
                else
                {
                    if (UICanvasPopup.instance)
                    {
                        UICanvasPopup.instance.AddPopup("Warning", "La confirmation de mot de passe n'est pas identique au mot de passe.");
                    }
                }
            }
            else
            {
                if (UICanvasPopup.instance)
                {
                    UICanvasPopup.instance.AddPopup("Warning", "Le mot de passe doit faire 6 caractere au minimum");
                }
            }
        }
        else
        {
            if (UICanvasPopup.instance)
            {
                UICanvasPopup.instance.AddPopup("Warning", "Le login doit faire 4 caractere au minimum");
            }
        }
    }
Example #4
0
    public void ButtonCharacterPlay()
    {
        if (GameManager.instance.characters.Count <= 0)
        {
            return;
        }

        /*Character character = null;
         * foreach(KeyValuePair<int, Character> charac in GameManager.instance.characters)
         * {
         *      character = charac.Value;
         *      break;
         * }*/
        ClientSocketScript css = GameManager.instance.GetComponent <ClientSocketScript>();

        css.Send(
            PacketHandler.newPacket(
                PacketHandler.PacketID_AccountCharacter,
                //character.index
                UICharacterSlot.selected.index
                )
            );
    }