Ejemplo n.º 1
0
 // Start is called before the first frame update
 void Start()
 {
     gameStage    = GameStage.Login;
     settingsPath = Application.dataPath + "/Settings.json";
     LoadSettings();
     Network.Connect();
 }
Ejemplo n.º 2
0
 void Start()
 {
     ScrollBar.size = 0.4f;
     Network.Enqueue(new C.RequestMapInformation {
     });
     // Inventory.gameObject.SetActive(false);
 }
Ejemplo n.º 3
0
 public void RemoveMemberFromParty(string playerName)
 {
     Network.Enqueue(new C.DeleteMemberFromGroup()
     {
         Name = playerName
     });
 }
Ejemplo n.º 4
0
 public void AllowGroupChange()
 {
     Network.Enqueue(new C.SwitchAllowGroup()
     {
         AllowGroup = allowGroupToggle.isOn
     });
 }
Ejemplo n.º 5
0
 void StartGame()
 {
     Network.Enqueue(new C.StartGame()
     {
         CharacterIndex = selectedCharacter.Index
     });
 }
Ejemplo n.º 6
0
    public void RegisterButton_OnClick()
    {
        string username = RegisterUserName.text;
        string password = RegisterPassword.text;
        string confirm  = ConfirmPassword.text;

        if (username == string.Empty || password == string.Empty)
        {
            return;
        }
        if (confirm != password)
        {
            return;
        }

        Network.Enqueue(new C.NewAccount
        {
            AccountID      = username,
            Password       = password,
            EMailAddress   = "*****@*****.**",
            BirthDate      = DateTime.Now,
            UserName       = "******",
            SecretQuestion = "na",
            SecretAnswer   = "na"
        });
    }
Ejemplo n.º 7
0
    private IEnumerator BeginChange(string sceneName, string fileName, Scene oldScene)
    {
        GameManager.CurrentScene = null;
        AsyncOperation unloadoperation = SceneManager.UnloadSceneAsync(oldScene);
        AsyncOperation loadoperation   = SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Additive);

        while (!unloadoperation.isDone || !loadoperation.isDone)
        {
            Network.Process();
            float progress = Mathf.Clamp01(loadoperation.progress / .9f) + Mathf.Clamp01(unloadoperation.progress / .9f);
            progress    /= 2f;
            slider.value = progress;
            yield return(null);
        }

        GameManager.CurrentScene.LoadMap(fileName);
        GameManager.GameScene.MiniMapDialog.CreateMinimap(fileName);
        GameManager.UserGameObject.transform.position = GameManager.CurrentScene.Cells[GameManager.User.Player.CurrentLocation.x, GameManager.User.Player.CurrentLocation.y].position;
        slider.value    = 1f;
        loadoperation   = null;
        unloadoperation = null;
        Hide();
        Network.Enqueue(new C.MapChanged {
        });
    }
Ejemplo n.º 8
0
 public void ReplyToPartyInvite(bool response)
 {
     Network.Enqueue(new C.RespondeToGroupInvite()
     {
         AcceptInvite = response
     });
     receiveInviteWindow.SetActive(false);
 }
Ejemplo n.º 9
0
 public void ConfirmRemovePlayerFromParty()
 {
     Network.Enqueue(new C.DeleteMemberFromGroup()
     {
         Name = currentSelectedMember
     });
     currentSelectedMember = "";
 }
Ejemplo n.º 10
0
 public void LogOut_Click()
 {
     MessageBox.Show($"Return to Character Select?", okbutton: true, cancelbutton: true);
     MessageBox.OK += () =>
     {
         Network.Enqueue(new C.LogOut());
         FindObjectOfType <LoadScreenManager>().Show();
     };
 }
Ejemplo n.º 11
0
 public void LogoutButton_OnClick()
 {
     MessageBox.Show($"Return to Login?", okbutton: true, cancelbutton: true);
     MessageBox.OK += () =>
     {
         Network.Enqueue(new C.Logout()
         {
         });
     };
 }
Ejemplo n.º 12
0
    /* TODO: Checks before sending package */
    /* TODO: Optomise, only delete member when refresh, don't remake the full list*/

    /* TODO: Packet receiver for initial allow group value or find where this is already sent
     *  Careful with the ChangeAllowGroupValue and recursive loop.*/
    /* TODO: Set currentSelectedMember to null when party window is closed */
    /* TODO: SEND IN PACKAGE partyMembers CLASS, LEVEL and ICON on join group - is PlayerIcon implemented yet? */
    /* TODO: Track partyMembers level for change? */
    /* TODO: Show partyMembers hp bar in HUD */
    /* TODO: Clean this shit up... it's a mess */


    public void LeaveParty() // This can't be the way to do this?
    {
        Network.Enqueue(new C.SwitchAllowGroup()
        {
            AllowGroup = false
        });
        Network.Enqueue(new C.SwitchAllowGroup()
        {
            AllowGroup = true
        });
    }
Ejemplo n.º 13
0
 private void CmdLeaveParty() // This can't be the way to do this?
 {
     Network.Enqueue(new ClientPackets.SwitchAllowGroup()
     {
         AllowGroup = false
     });
     Network.Enqueue(new ClientPackets.SwitchAllowGroup()
     {
         AllowGroup = true
     });
 }
Ejemplo n.º 14
0
 public void ChangeAttackMode(int amode)
 {
     if (amode >= Enum.GetNames(typeof(AttackMode)).Length)
     {
         return;
     }
     Network.Enqueue(new C.ChangeAMode()
     {
         Mode = (AttackMode)amode
     });
 }
Ejemplo n.º 15
0
    public void NPCTextButton(string LinkId)
    {
        if (LinkId == "@exit")
        {
            NPCDialog.gameObject.SetActive(false);
            return;
        }

        Network.Enqueue(new C.CallNPC {
            ObjectID = NPCID, Key = "[" + LinkId + "]"
        });
        GameManager.InputDelay = Time.time + 0.5f;
    }
Ejemplo n.º 16
0
    public void Create_Click()
    {
        if (NameInput.text.Length < 5)
        {
            ShowMessageBox("Name must be minimum 5 characters");
            return;
        }

        Network.Enqueue(new C.NewCharacter
        {
            Name   = NameInput.text,
            Class  = selectedClass,
            Gender = selectedGender
        });
    }
Ejemplo n.º 17
0
    public void DeleteCharacter_OnClick()
    {
        if (selectedCharacter == null)
        {
            return;
        }

        MessageBox.Show($"Delete {selectedCharacter.Name}?", okbutton: true, cancelbutton: true);
        MessageBox.OK += () =>
        {
            Network.Enqueue(new C.DeleteCharacter()
            {
                CharacterIndex = selectedCharacter.Index
            });
        };
    }
Ejemplo n.º 18
0
    public void LoginButton_OnClick()
    {
        string username = UserName.text;
        string password = Password.text;

        if (username == string.Empty || password == string.Empty)
        {
            return;
        }

        Network.Enqueue(new C.Login
        {
            AccountID = username,
            Password  = password
        });

        UserName.text = string.Empty;
        Password.text = string.Empty;
    }
Ejemplo n.º 19
0
    private IEnumerator BeginLoad(string sceneName, string fileName)
    {
        AsyncOperation operation = SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Additive);

        while (!operation.isDone)
        {
            Network.Process();
            float progress = Mathf.Clamp01(operation.progress / .9f);
            slider.value = progress;
            yield return(null);
        }

        GameManager.CurrentScene.LoadMap(fileName);
        GameManager.GameScene.MiniMapDialog.CreateMinimap(fileName);
        slider.value = operation.progress;
        operation    = null;
        Hide();
        Network.Enqueue(new C.MapLoaded {
        });
    }
Ejemplo n.º 20
0
 public void SendInviteToPlayer()
 {
     if (!RoomForMorePlayers())
     {
         return;
     }
     if (!IsPartyLeader())
     {
         return;
     }
     if (inputPlayerName.text.Length <= 3)
     {
         return;
     }
     Network.Enqueue(new C.AddMemberToGroup()
     {
         Name = inputPlayerName.text
     });
     inputPlayerName.text = "";
     inviteWindow.SetActive(false);
 }
Ejemplo n.º 21
0
    public void MapChanged(S.MapChanged p)
    {
        ClearObjects();
        ClearAction();
        User.Player.CurrentLocation = new Vector2Int(p.Location.X, p.Location.Y);

        if (p.SceneName != CurrentScene.gameObject.scene.name)
        {
            FindObjectOfType <LoadScreenManager>().ChangeScene(p.SceneName, p.FileName, CurrentScene.gameObject.scene);
        }
        else
        {
            if (p.FileName != CurrentScene.FileName)
            {
                CurrentScene.LoadMap(p.FileName);
                GameScene.MiniMapDialog.CreateMinimap(p.FileName);
            }
            Network.Enqueue(new C.MapChanged {
            });
            UserGameObject.transform.position = CurrentScene.Cells[User.Player.CurrentLocation.x, User.Player.CurrentLocation.y].position;
        }
    }
Ejemplo n.º 22
0
    public void ChangePasswordButton_OnClick()
    {
        string username    = ChangeUserName.text;
        string password    = ChangeCurrentPassword.text;
        string newpassword = ChangeNewPassword.text;
        string confirm     = ChangeConfirmPassword.text;

        if (username == string.Empty || password == string.Empty || newpassword == string.Empty)
        {
            return;
        }
        if (confirm != newpassword)
        {
            return;
        }

        Network.Enqueue(new C.ChangePassword
        {
            AccountID       = username,
            CurrentPassword = password,
            NewPassword     = newpassword
        });
    }
Ejemplo n.º 23
0
    public void OnLoaded()
    {
        activeLocation   = GameObject.Find("ActiveLocation");
        inactiveLocation = GameObject.Find("InactiveLocation");
        previewLocation  = GameObject.Find("PreviewLocation");
        loginCamera      = GameObject.Find("LoginCamera");
        LoginPosition    = GameObject.Find("LoginCameraPosition").transform;
        CharSelPosition  = GameObject.Find("CharSelCameraPosition").transform;

        loginCamera.gameObject.SetActive(false);
        loginCamera.transform.SetPositionAndRotation(CharSelPosition.position, CharSelPosition.rotation);
        loginCamera.gameObject.SetActive(true);
        loginCamera.GetComponent <CameraFade>().Reset();
        loginCamera.GetComponent <CameraFade>().CurrentCurve = loginCamera.GetComponent <CameraFade>().FadeInCurve;
        audioSource.Play();
        Camera.main.fieldOfView = 50;
        SelectCharacterBox.SetActive(true);
        LogOutButton.gameObject.SetActive(true);
        GameManager.gameStage = GameStage.Select;
        Network.Enqueue(new C.RequestCharacters {
        });
        FindObjectOfType <LoadScreenManager>().Hide();
    }
Ejemplo n.º 24
0
    public override void SetAction()
    {
        if (this == GameManager.User.Player && Time.time > GameManager.NextAction && GameScene.QueuedAction != null)
        {
            ActionFeed.Clear();
            ActionFeed.Add(GameScene.QueuedAction);
            GameScene.QueuedAction = null;
        }

        if (ActionFeed.Count == 0)
        {
            if (Dead)
            {
                CurrentAction = MirAction.Dead;
            }
            else
            {
                CurrentAction = MirAction.Standing;
            }
        }
        else
        {
            if (this == GameManager.User.Player && Time.time < GameManager.NextAction)
            {
                return;
            }
            QueuedAction action = ActionFeed[0];
            ActionFeed.RemoveAt(0);

            CurrentAction            = action.Action;
            Direction                = action.Direction;
            Model.transform.rotation = ClientFunctions.GetRotation(Direction);

            switch (CurrentAction)
            {
            case MirAction.Walking:
            case MirAction.Running:
                int steps = 1;
                if (CurrentAction == MirAction.Running)
                {
                    steps = 2;
                }

                Vector3 targetpos = GameManager.CurrentScene.Cells[action.Location.x, action.Location.y].position;
                TargetPosition = targetpos;

                if (this != GameManager.User.Player)
                {
                    Vector2Int back = ClientFunctions.Back(action.Location, Direction, steps);
                    gameObject.transform.position = GameManager.CurrentScene.Cells[back.x, back.y].position;
                }

                GameManager.CurrentScene.Cells[CurrentLocation.x, CurrentLocation.y].RemoveObject(this);
                GameManager.CurrentScene.Cells[action.Location.x, action.Location.y].AddObject(this);

                StartPosition  = gameObject.transform.position;
                TargetDistance = Vector3.Distance(transform.position, targetpos);
                IsMoving       = true;

                RefreshSounds();
                break;
            }

            CurrentLocation = action.Location;

            Spell = Spell.None;

            if (this == GameManager.User.Player)
            {
                switch (CurrentAction)
                {
                case MirAction.Standing:
                    Network.Enqueue(new C.Turn {
                        Direction = action.Direction
                    });
                    GameManager.NextAction  = Time.time + 2.5f;
                    GameManager.InputDelay  = Time.time + 0.5f;
                    GameManager.User.CanRun = false;
                    break;

                case MirAction.Walking:
                    Network.Enqueue(new C.Walk {
                        Direction = action.Direction
                    });
                    GameManager.NextAction       = Time.time + 2.5f;
                    GameManager.InputDelay       = Time.time + 0.5f;
                    GameManager.User.LastRunTime = Time.time;
                    GameManager.User.CanRun      = true;
                    break;

                case MirAction.Running:
                    Network.Enqueue(new C.Run {
                        Direction = action.Direction
                    });
                    GameManager.NextAction       = Time.time + 2.5f;
                    GameManager.InputDelay       = Time.time + 0.5f;
                    GameManager.User.LastRunTime = Time.time;
                    break;

                case MirAction.Attack:
                    if (GameScene.Slaying && GameScene.TargetObject != null)
                    {
                        Spell             = Spell.Slaying;
                        GameScene.Slaying = false;
                    }

                    Network.Enqueue(new C.Attack {
                        Direction = Direction, Spell = Spell
                    });
                    GameManager.NextAction = Time.time + 2.5f;
                    break;

                case MirAction.Die:
                    Blocking = false;
                    if (HealthBar != null)
                    {
                        HealthBar.gameObject.SetActive(false);
                    }
                    break;

                case MirAction.Revive:
                    Blocking = true;
                    ActionFeed.Clear();
                    ActionFeed.Add(new QueuedAction {
                        Action = MirAction.Standing, Direction = action.Direction
                    });
                    //GameScene.pControl.TextureValid = false;
                    break;
                }
            }

            switch (CurrentAction)
            {
            case MirAction.Attack:
                PlayAnimation("Attack", -1, 0);
                break;

            case MirAction.Struck:
                SetAnimation("Struck", true);
                break;
            }
        }
        //GetComponentInChildren<Animator>()?.SetInteger("CurrentAction", (int)CurrentAction);
        SetAnimation("CurrentAction", (int)CurrentAction);
    }
Ejemplo n.º 25
0
 private void CmdSpecialRepairItem(UserItem item) =>
 Network.Enqueue(new C.SRepairItem()
 {
     UniqueID = item.UniqueID
 });
Ejemplo n.º 26
0
 private void CmdBuyItem(ulong itemUniqueId, uint count) =>
 Network.Enqueue(new C.BuyItem()
 {
     ItemIndex = itemUniqueId, Count = count, Type = PanelType.Buy
 });
Ejemplo n.º 27
0
 private void CmdBuyItem(UserItem item) =>
 Network.Enqueue(new C.BuyItem()
 {
     ItemIndex = item.UniqueID, Count = 1, Type = PanelType.Buy
 });
Ejemplo n.º 28
0
 private void CmdSellItem(UserItem item) =>
 Network.Enqueue(new C.SellItem()
 {
     UniqueID = item.UniqueID, Count = item.Count
 });
Ejemplo n.º 29
0
 private void CmdSendInviteToPlayer(string memberName) =>
 Network.Enqueue(new C.AddMemberToGroup()
 {
     Name = memberName
 });
Ejemplo n.º 30
0
 private void CmdReplyToInvite(bool response) =>
 Network.Enqueue(new C.RespondeToGroupInvite()
 {
     AcceptInvite = response
 });