Example #1
0
        public void init(Client_Engine eng)
        {
            e = eng;

            ConnectionConfig conf = new ConnectionConfig();

            conf.AddChannel(QosType.ReliableFragmented);
            conf.AddChannel(QosType.UnreliableFragmented);
            conf.ConnectTimeout       = 1000;
            conf.MaxConnectionAttempt = 5;
            Client = new NetworkClient();
            Client.Configure(conf, 1);
            Client.RegisterHandler(MsgType.Connect, net_onServerConnect);
            Client.RegisterHandler(MsgType.Error, net_onError);
            Client.RegisterHandler(MsgType.Disconnect, net_onServerDisconnect);
            Client.RegisterHandler(OPCodes.S2GC_AskLoginResponse, net_onAskLoginResponse);
            Client.RegisterHandler(OPCodes.S2GC_AskCharacterListResponse, net_onCharacterListResponse);
            Client.RegisterHandler(OPCodes.S2GC_AskCreateCharacterResponse, net_onAskCreateCharacterResponse);
            Client.RegisterHandler(OPCodes.S2GC_AskDeleteCharacterResponse, net_onAskDeleteCharacterResponse);
            Client.RegisterHandler(OPCodes.S2GC_AskEnterWorldResponse, net_onAskEnterWorldResponse);
            Client.RegisterHandler(OPCodes.S2GC_ClientPlayerSpawn, net_onClientSelfSpawn);
            Client.RegisterHandler(OPCodes.S2GC_OtherClientSpawn, net_onOtherClientSpawn);
            Client.RegisterHandler(OPCodes.S2GC_FullClientList, net_onFullClientList);
            Client.RegisterHandler(OPCodes.S2GC_UpdatePlayerStates, net_onUpdatePlayerStates);
            Client.RegisterHandler(OPCodes.S2GC_UpdateNPCStates, net_onUpdateNPCStates);
            Client.RegisterHandler(OPCodes.S2GC_FullNPCList, net_onFullNPCList);
            Client.RegisterHandler(OPCodes.S2GC_UpdateEntityStates, net_onUpdateEnityStates);
            Client.RegisterHandler(OPCodes.S2GC_OtherClientDisconnect, net_onOtherClientDisconnect);
            Client.RegisterHandler(OPCodes.S2GC_CastSpell, net_onSpellCast);
            Client.RegisterHandler(OPCodes.GC2S2GC_ChatMessage, net_onChatMessage);
            Client.RegisterHandler(OPCodes.S2GC_PlayerEnterCombat, net_onEnterCombat);
            Client.RegisterHandler(OPCodes.S2GC_PlayerExitCombat, net_onExitCombat);
            Client.RegisterHandler(OPCodes.S2GC_GiveQuest, net_onGivenQuest);
            Client.RegisterHandler(OPCodes.S2GC_UpdateQuest, net_onUpdateQuests);
        }
Example #2
0
        public static void initSkills(Client_Engine e)
        {
            SkillList.Add(new TestSkill(0001));



            foreach (BaseSkill s in SkillList)
            {
                s.init(e);
            }
        }
Example #3
0
        public void Init(Client_Engine en)
        {
            e      = en;
            _Model = Client_PlayerModelData.BuildPlayerModel(this);
            _Model.transform.SetParent(transform, false);

            _Animator       = _Model.GetComponent <Animator>();
            _FeetIK         = _Model.AddComponent <FootIKSmooth>();
            _FeetIK.anim    = _Animator;
            _FeetIK.RayMask = groundLayer;

            Ready = true;
        }
Example #4
0
        public void Create(Client_Engine eng, BaseNPC_Client n)
        {
            e = eng;
            gameObject.name = n.uniqueID + "_Nameplate";
            Vector3 viewPos = Camera.main.WorldToViewportPoint(n.gameObject.transform.position);

            transform.position = new Vector3((viewPos.x - 0.5f) * Camera.main.pixelWidth, (viewPos.y - 0.5f) * Camera.main.pixelHeight, 0f);
            playerTarget       = n.gameObject;
            setNameplateName(n.Name);
            setNameplateColor((int)n.Faction);
            setNameplateHealthValues(n.currentHealth, n.maxHealth);
            //parent.Nameplate.GetComponent<Nameplate>().setNameplateEnergyValues(state.curEnergy, state.maxEnergy);
            ID = n.uniqueID;
        }
Example #5
0
        public void Create(Client_Engine eng, PlayerData_Other n)
        {
            e               = eng;
            isPlayer        = true;
            gameObject.name = n.CharacterName + "_Nameplate";
            Vector3 viewPos = Camera.main.WorldToViewportPoint(n.gameObject.transform.position);

            transform.position = new Vector3((viewPos.x - 0.5f) * Camera.main.pixelWidth, (viewPos.y - 0.5f) * Camera.main.pixelHeight, 0f);
            playerTarget       = n.gameObject;
            setNameplateName(n.CharacterName);
            setNameplateColor(3);
            setNameplateHealthValues(n.Health, n.maxHealth);
            setNameplateEnergyValues(n.Energy, n.maxEnergy);
            targetOffset.y = 3.25f;
            ID             = n.PlayerID;
        }
Example #6
0
 public void init(Client_Engine eng)
 {
     e = eng;
     playerSelfPrefab  = e.PlayerSelfPrefab;
     playerOtherPrefab = e.PlayerOtherPrefab;
 }
 public void init(Client_Engine en)
 {
     e = en;
 }
 public void init(Client_Engine eng)
 {
     e = eng;
 }
 public abstract void init(Client_Engine en);
        public void init(Client_Engine eng)
        {
            e = eng;
            // Global ui objects
            IngameUI_Root = e.IngameRoot;
            LoginUI_Root  = e.LoginRoot;
            // Login ui objects
            login_Username    = e.LoginName.GetComponent <InputField>();
            login_Password    = e.LoginPassword.GetComponent <InputField>();
            login_LoginButton = e.LoginButton.GetComponent <Button>();
            login_ErrorText   = e.LoginError.GetComponent <Text>();

            //EventDelegate.Add(login_LoginButton.onClick, e.getNetwork().net_loginConnect);
            login_LoginButton.onClick.AddListener(ui_login_VerifyLogin);

            LoginUI_Root.SetActive(true);


            // Lobby screen things
            LobbyUI_Root = e.LobbyRoot;
            Lobby        = e.Lobby.GetComponent <UI_Lobby>();

            Lobby.Init();
            Lobby.onCreateCharacter.AddListener(delegate
            {
                e.getNetwork().net_lobbyAskCreateCharacter(Lobby.preview_CharacterData);
            });

            Lobby.onDeleteCharacter.AddListener(delegate
            {
                e.getNetwork().net_lobbyAskDeleteCharacter(Lobby.SelectedCharacter);
            });

            Lobby.onEnterWorld.AddListener(delegate
            {
                e.getNetwork().net_lobbyAskWorldConnect(Lobby.SelectedCharacter);
            });

            Lobby.onLogout.AddListener(delegate
            {
                e.getNetwork().net_FullClientDisconnect();
                ui_login_Disconnected("Logged out.");
            });


            // Loading screen
            LoadingUI_Root = e.LoadingRoot;
            loading_Slider = e.LoadingSlider.GetComponent <Slider>();

            // Ingame chat ui objects
            chat_Prefab = e.ChatPrefab;
            //chat_Panel = e.ChatPanel.GetComponent<Image>();
            chat_Input     = e.ChatInput.GetComponent <InputField>();
            chat_Grid      = e.ChatGrid;
            chat_Scrollbar = e.ChatScrollbar.GetComponent <Scrollbar>();
            //chat_Button = e.ChatButton.GetComponent<UIButton>();

            // Ingame things
            nameplate_Parent             = e.NameplateParent;
            nameplate_Prefab             = e.NameplatePrefab;
            nameplateNPC_Prefab          = e.NameplateNPCPrefab;
            nameplateFloatingText_Prefab = e.NamePlateFloatingTextPrefab;

            player_HEERoot   = e.HEEParent;
            player_HealthBar = e.PlayerHealthBar.GetComponent <Slider>();
            player_EnergyBar = e.PlayerEnergyBar.GetComponent <Slider>();
            player_EXPBar    = e.PlayerEXPBar.GetComponent <Slider>();

            //Actionbar
            foreach (Transform t in e.ActionbarParent.transform)
            {
                ActionbarButtons.Add(t.GetComponent <SkillButton>());
            }
            int sI = 0;

            foreach (SkillButton s in ActionbarButtons)
            {
                int ind = sI;
                s.castButton.onClick.AddListener(delegate { ui_ingame_onSkillClick(ind); });
                s.onHover.AddListener(delegate { ui_ingame_onSkillHoverStart(ind); });
                s.onExit.AddListener(delegate { ui_ingame_onSkillHoverEnd(ind); });
                sI++;
            }


            //Tooltip
            tooltip_Parent      = e.TooltipParent;
            tooltip_Icon        = e.TooltipIcon.GetComponent <Image>();
            tooltip_Title       = e.TooltipTitle.GetComponent <Text>();
            tooltip_Description = e.TooltipDesc.GetComponent <Text>();

            //Quest Tracker
            QuestTracker = e.QuestTracker.GetComponent <UI_QuestTracker>();

            QuestPopup = e.QuestPopup.GetComponent <Window_QuestPopup>();
            QuestPopup.onAcceptQuest.AddListener(delegate
            {
                ui_ingame_askAcceptQuest();
            });
            QuestPopup.onCompleteQuest.AddListener(delegate
            {
                ui_ingame_askCompleteQuest();
            });
            ingame_ErrorText = e.IngameErrorText.GetComponent <Text>();
            //EventDelegate.Add(chat_Button.onClick, e.getNetwork().net_sendChatMessage);
        }
        public void init(Client_Engine eng)
        {
            e = eng;

            SceneManager.sceneLoaded += scene_OnLevelLoad;
        }