コード例 #1
0
ファイル: GameManager.cs プロジェクト: robbobby/Emerald
 // Start is called before the first frame update
 void Start()
 {
     gameStage    = GameStage.Login;
     settingsPath = Application.dataPath + "/Settings.json";
     LoadSettings();
     Network.Connect();
 }
コード例 #2
0
ファイル: GameSceneManager.cs プロジェクト: robbobby/Emerald
 void Start()
 {
     ScrollBar.size = 0.4f;
     Network.Enqueue(new C.RequestMapInformation {
     });
     // Inventory.gameObject.SetActive(false);
 }
コード例 #3
0
 public void RemoveMemberFromParty(string playerName)
 {
     Network.Enqueue(new C.DeleteMemberFromGroup()
     {
         Name = playerName
     });
 }
コード例 #4
0
 public void AllowGroupChange()
 {
     Network.Enqueue(new C.SwitchAllowGroup()
     {
         AllowGroup = allowGroupToggle.isOn
     });
 }
コード例 #5
0
ファイル: CharSelManager.cs プロジェクト: robbobby/Emerald
 void StartGame()
 {
     Network.Enqueue(new C.StartGame()
     {
         CharacterIndex = selectedCharacter.Index
     });
 }
コード例 #6
0
ファイル: LoginManager.cs プロジェクト: robbobby/Emerald
    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"
        });
    }
コード例 #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 {
        });
    }
コード例 #8
0
 public void ReplyToPartyInvite(bool response)
 {
     Network.Enqueue(new C.RespondeToGroupInvite()
     {
         AcceptInvite = response
     });
     receiveInviteWindow.SetActive(false);
 }
コード例 #9
0
 public void ConfirmRemovePlayerFromParty()
 {
     Network.Enqueue(new C.DeleteMemberFromGroup()
     {
         Name = currentSelectedMember
     });
     currentSelectedMember = "";
 }
コード例 #10
0
ファイル: GameSceneManager.cs プロジェクト: robbobby/Emerald
 public void LogOut_Click()
 {
     MessageBox.Show($"Return to Character Select?", okbutton: true, cancelbutton: true);
     MessageBox.OK += () =>
     {
         Network.Enqueue(new C.LogOut());
         FindObjectOfType <LoadScreenManager>().Show();
     };
 }
コード例 #11
0
ファイル: CharSelManager.cs プロジェクト: robbobby/Emerald
 public void LogoutButton_OnClick()
 {
     MessageBox.Show($"Return to Login?", okbutton: true, cancelbutton: true);
     MessageBox.OK += () =>
     {
         Network.Enqueue(new C.Logout()
         {
         });
     };
 }
コード例 #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
        });
    }
コード例 #13
0
ファイル: PartyController.cs プロジェクト: robbobby/Emerald
 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
     });
 }
コード例 #14
0
ファイル: GameSceneManager.cs プロジェクト: robbobby/Emerald
 public void ChangeAttackMode(int amode)
 {
     if (amode >= Enum.GetNames(typeof(AttackMode)).Length)
     {
         return;
     }
     Network.Enqueue(new C.ChangeAMode()
     {
         Mode = (AttackMode)amode
     });
 }
コード例 #15
0
ファイル: GameSceneManager.cs プロジェクト: robbobby/Emerald
    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;
    }
コード例 #16
0
ファイル: CharSelManager.cs プロジェクト: robbobby/Emerald
    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
        });
    }
コード例 #17
0
ファイル: CharSelManager.cs プロジェクト: robbobby/Emerald
    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
            });
        };
    }
コード例 #18
0
ファイル: LoginManager.cs プロジェクト: robbobby/Emerald
    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;
    }
コード例 #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 {
        });
    }
コード例 #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);
 }
コード例 #21
0
ファイル: GameManager.cs プロジェクト: robbobby/Emerald
    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;
        }
    }
コード例 #22
0
ファイル: LoginManager.cs プロジェクト: robbobby/Emerald
    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
        });
    }
コード例 #23
0
ファイル: CharSelManager.cs プロジェクト: robbobby/Emerald
    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();
    }
コード例 #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);
    }
コード例 #25
0
 private void CmdSpecialRepairItem(UserItem item) =>
 Network.Enqueue(new C.SRepairItem()
 {
     UniqueID = item.UniqueID
 });
コード例 #26
0
 private void CmdBuyItem(ulong itemUniqueId, uint count) =>
 Network.Enqueue(new C.BuyItem()
 {
     ItemIndex = itemUniqueId, Count = count, Type = PanelType.Buy
 });
コード例 #27
0
 private void CmdBuyItem(UserItem item) =>
 Network.Enqueue(new C.BuyItem()
 {
     ItemIndex = item.UniqueID, Count = 1, Type = PanelType.Buy
 });
コード例 #28
0
 private void CmdSellItem(UserItem item) =>
 Network.Enqueue(new C.SellItem()
 {
     UniqueID = item.UniqueID, Count = item.Count
 });
コード例 #29
0
ファイル: PartyController.cs プロジェクト: robbobby/Emerald
 private void CmdSendInviteToPlayer(string memberName) =>
 Network.Enqueue(new C.AddMemberToGroup()
 {
     Name = memberName
 });
コード例 #30
0
ファイル: PartyController.cs プロジェクト: robbobby/Emerald
 private void CmdReplyToInvite(bool response) =>
 Network.Enqueue(new C.RespondeToGroupInvite()
 {
     AcceptInvite = response
 });