Ejemplo n.º 1
0
        private void SendLog(LiteNetLibManager.Player player, LogData data)
        {
            LogData2Client msg = new LogData2Client();

            msg.logData = data;
            netManager.Send(player, msg);
        }
Ejemplo n.º 2
0
 protected override void OnPlayerLogin(LiteNetLibManager.Player player)
 {
     foreach (var item in infoDatas)
     {
         Send2Client(player, item);
     }
 }
Ejemplo n.º 3
0
        private void SendSwitchState2Client(LiteNetLibManager.Player player)
        {
            FunctionSwitch2Client msg = new FunctionSwitch2Client();

            msg.functionName   = FunctionName;
            msg.isOpenFunction = isOpenFunction;
            netManager.Send(player, msg);
        }
Ejemplo n.º 4
0
        protected override void OnPlayerLoginAfter(LiteNetLibManager.Player player)
        {
            List <LogData> list = new List <LogData>(logDatas);

            foreach (var data in list)
            {
                SendLog(player, data);
            }
        }
Ejemplo n.º 5
0
        private static void Send2Client(LiteNetLibManager.Player player, ShowInfoData data)
        {
            if (LitNetServer.NetManager != null)
            {
                AppInfoData2Client msg = new AppInfoData2Client();
                msg.data = data;

                LitNetServer.NetManager.Send(player, msg);
            }
        }
        protected override void OnPlayerLogin(LiteNetLibManager.Player player)
        {
            foreach (var mData in invokeMothodsInfos)
            {
                List <MethodInfo> methods = mData.Value;

                foreach (MethodInfo m in methods)
                {
                    RemoteInvokingAttribute attribute = GetCustomAttribute <RemoteInvokingAttribute>(m);
                    MethodData2Client       msg       = new MethodData2Client();


                    msg.data.methodType = attribute.methodType;

                    msg.data.showName      = attribute.name;
                    msg.data.description   = attribute.description;
                    msg.data.classFullName = mData.Key.FullName;
                    msg.data.methodName    = m.Name;

                    ParameterInfo[] parameters = m.GetParameters();

                    IEnumerable <ParamsDescriptionAttribute> paramsDescriptions = GetCustomAttributes <ParamsDescriptionAttribute>(m);
                    for (int i = 0; i < parameters.Length; i++)
                    {
                        ParameterInfo p          = parameters[i];
                        ParamsData    paramsData = new ParamsData();

                        ParamsDescriptionAttribute paramsDescription = ParamsDescriptionAttribute.GetParamsDescription(paramsDescriptions, p.Name);;
                        if (paramsDescription != null)
                        {
                            paramsData.descriptionName = paramsDescription.paramsDescriptionName;
                        }

                        paramsData.paraName         = p.Name;
                        paramsData.paraTypeFullName = p.ParameterType.FullName;
                        try
                        {
                            paramsData.defaultValueStr = GetDefaultValueString(mData.Key, p.ParameterType, paramsDescription);
                        }
                        catch (Exception e)
                        {
                            Debug.LogError(mData.Key.FullName + "." + m.Name + "\n" + e);
                        }

                        paramsData.selectItemValues = GetTypeSelectItemValues(p.ParameterType, paramsDescription);
                        msg.data.paramsDatas.Add(paramsData);
                    }
                    Debug.Log("Send MethodData2Client:" + JsonUtility.ToJson(msg));
                    netManager.Send(player, msg);
                }
            }
        }
        public override uint LoginLogic(Login2Server msg, long connectId, out LiteNetLibManager.Player player)
        {
            GameConsolePanelSettingConfig config = GameConsolePanelSettingConfig.GetCofig();

            string key = msg.key;
            string pw  = msg.password;

            if (config.loginKey.Equals(key) && config.loginPassword.Equals(pw))
            {
                player          = new LiteNetLibManager.Player(connectId);
                player.playerID = Guid.NewGuid().ToString();

                return(0);
            }
            player = null;
            return(102);
        }
Ejemplo n.º 8
0
        private void OnPlayerLoginEvent(LiteNetLibManager.Player player)
        {
            SendSwitchState2Client(player);

            OnPlayerLogin(player);
        }
Ejemplo n.º 9
0
 private void OnPlayerLoginAfterEvent(LiteNetLibManager.Player player)
 {
     OnPlayerLoginAfter(player);
 }
Ejemplo n.º 10
0
 protected virtual void OnPlayerLoginAfter(LiteNetLibManager.Player player)
 {
 }