Пример #1
0
    public void InitSvc()
    {
        Instance = this;

        client = new PENet.PESocket <ClientSession, GameMsg>();
        client.SetLog(true, (string msg, int lv) => {
            switch (lv)
            {
            case 0:
                msg = "Log:" + msg;
                Debug.Log(msg);
                break;

            case 1:
                msg = "Warn:" + msg;
                Debug.LogWarning(msg);
                break;

            case 2:
                msg = "Error:" + msg;
                Debug.LogError(msg);
                break;

            case 3:
                msg = "Info:" + msg;
                Debug.Log(msg);
                break;

            default:
                break;
            }
        });
        client.StartAsClient(SrvCfg.srvIP, SrvCfg.srvPort);
        Common.Log(GetType() + "/InitSvc()/Init NetSvc...");
    }
Пример #2
0
    /// <summary>
    /// 初始化所有模块
    /// </summary>
    void Init()
    {
        //初始化服务模块
        mResSvc = GetComponent <ResSvc>();
        mResSvc.InitSvc();

        mNetSvc = GetComponent <NetSvc>();
        mNetSvc.InitSvc();

        mAudioSvc = GetComponent <AudioSvc>();
        mAudioSvc.InitAudio();

        //初始化业务系统
        mLogonSys = GetComponent <LogonSys>();
        mLogonSys.InitSys();

        mMainGameSys = GetComponent <MainGameSys>();
        mMainGameSys.InitMainGameSys();

        mCombatSys = GetComponent <CombatSys>();
        mCombatSys.InitCombatSys();
        //初始化控制器模块
        mControllerMag = new ControllerManage();
        mControllerMag.InitController();


        //进入登录系统
        mLogonSys.EnterLogin();
    }
Пример #3
0
    public void Start()
    {
        netSvc = GetComponent <NetSvc>();
        netSvc.InitSvc();

        Debug.Log("GameApp Start...");
    }
Пример #4
0
    public void InitSvc()
    {
        Instance = this;

        client = new PESocket <ClientSession, GameMsg>();
        // 将PESocket中的日志输出到Unity控制台上
        client.SetLog(true, (string msg, int lv) =>
        {
            switch (lv)
            {
            case 0:
                msg = "Log:" + msg;
                Debug.Log(msg);
                break;

            case 1:
                msg = "Warn:" + msg;
                Debug.LogWarning(msg);
                break;

            case 2:
                msg = "Error:" + msg;
                Debug.LogError(msg);
                break;

            case 3:
                msg = "Info:" + msg;
                Debug.Log(msg);
                break;
            }
        });

        client.StartAsClient(ServerConfig.serverIP, ServerConfig.serverPort);
        PECommon.Log("Init NetSvc...");
    }
Пример #5
0
    private void Init()
    {
        //服务模块初始化
        NetSvc net = GetComponent <NetSvc>();
        //net.InitSvc();
        // ResSvc res = GetComponent<ResSvc>();
        // res.InitSvc();
        // AudioSvc audio = GetComponent<AudioSvc>();
        // audio.InitSvc();
        // TimerSvc timer = GetComponent<TimerSvc>();
        // timer.InitSvc();


        //业务系统初始化
        LoginSys login = GetComponent <LoginSys>();

        login.InitSys();

        // MainCitySys maincity = GetComponent<MainCitySys>();
        // maincity.InitSys();
        // FubenSys fuben = GetComponent<FubenSys>();
        // fuben.InitSys();
        // BattleSys battle = GetComponent<BattleSys>();
        // battle.InitSys();

        //UIMgr.OpenPanel(QAssetBundle.Loadingwnd_prefab.LOADINGWND);
        // dynamicWnd.SetWndState();
        //进入登录场景并加载相应UI
        //login.EnterLogin();
    }
Пример #6
0
    private void Init()
    {
        //服务模块初始化
        NetSvc netSvc = GetComponent <NetSvc>();

        netSvc.InitSvc();
        ResSvc res = GetComponent <ResSvc>();

        res.InitSvc();
        AudioSvc audio = GetComponent <AudioSvc>();

        audio.InitSvc();
        TimerSvc timerSvc = GetComponent <TimerSvc>();

        timerSvc.InitSvc();


        //业务系统初始化
        UISys uiSys = GetComponent <UISys>();

        uiSys.InitSys();
        BattleSys battleSys = GetComponent <BattleSys>();

        battleSys.InitSys();

        //dynamicWnd.SetWndState();
        //进入登录场景并加载相应UI
        uiSys.EnterLogin();
    }
Пример #7
0
 /// <summary>
 /// 清理窗口
 /// </summary>
 protected virtual void ClearWnd()
 {
     _resSvc   = null;
     _audioSvc = null;
     _netSvc   = null;
     _timerSvc = null;
 }
Пример #8
0
 protected virtual void ClearWnd()
 {
     resSvc   = null;
     audioSvc = null;
     netSvc   = null;
     timerSvc = null;
 }
Пример #9
0
    private void Init()
    {
        //服务模块初始化
        ResSvc res = GetComponent <ResSvc>();

        res.InitSvc();
        NetSvc net = GetComponent <NetSvc>();

        net.InitSvc();
        AudioSvc audio = GetComponent <AudioSvc>();

        audio.InitSvc();
        TimerSvc timer = GetComponent <TimerSvc>();

        timer.InitSvc();

        //业务系统初始化
        LoginSys login = GetComponent <LoginSys>();

        login.InitSys();
        MainCitySys mainCitySys = GetComponent <MainCitySys>();

        mainCitySys.InitSys();
        FubenSys fubenSys = GetComponent <FubenSys>();

        fubenSys.InitSys();
        BattleSys battleSys = GetComponent <BattleSys>();

        battleSys.InitSys();

        dynamicWind.SetWindowState();
        //进入登入场景并加载UI
        login.EnterLogin();
    }
Пример #10
0
    /// <summary>
    /// 初始化
    /// </summary>
    public void InitSvc()
    {
        Instance = this;
        CommonTools.Log("Init NetSvc...");

        clientSock = new WZNet.WZSocket <ClientSession, NetMsg>();
        //设置打印日志接口
        clientSock.SetLog(true, (string msg, int lv) =>
        {
            switch (lv)
            {
            case 0:
                msg = "Log: " + msg;
                break;

            case 1:
                msg = "Warnning: " + msg;
                break;

            case 2:
                msg = "Error: " + msg;
                break;

            case 3:
                msg = "Info: " + msg;
                break;
            }
            Debug.Log(msg);
        });

        //启动客户端网络
        clientSock.StartAsClient(ServerCfg.srvIP, ServerCfg.srvPort);
    }
Пример #11
0
 public virtual void InitSys()
 {
     resSvc   = ResSvc.Instance;
     audioSvc = AudioSvc.Instance;
     netSvc   = NetSvc.Instance;
     timerSvc = TimerSvc.Instance;
 }
Пример #12
0
    public void InitSec()
    {
        Instance = this;
        client   = new PENet.PESocket <ClientSession, NetMsg>();
        client.SetLog(true, (string msg, int lv) => {
            switch (lv)
            {
            case 0:     //当日志等级是0的时候
                msg = "Log" + msg;
                Debug.Log(msg);
                break;

            case 1:     //当日志等级是0的时候
                msg = "Warn" + msg;
                Debug.Log(msg);
                break;

            case 2:     //当日志等级是0的时候
                msg = "Error" + msg;
                Debug.Log(msg);
                break;

            case 3:     //当日志等级是0的时候
                msg = "Info" + msg;
                Debug.Log(msg);
                break;
            }
        });
        client.StartAsClient(IPConfig.srvIP, IPConfig.srvport);

        Debug.Log("Network Service Connected");
    }
Пример #13
0
 protected virtual void InitPanel()
 {
     resSvc   = ResSvc.Ins;
     audioSvc = AudioSvc.Ins;
     netSvc   = NetSvc.Ins;
     timerSvc = TimerSvc.Ins;
 }
Пример #14
0
 public virtual void ClearSvc()
 {
     resSvc   = null;
     audioSvc = null;
     netSvc   = null;
     timerSvc = null;
 }
Пример #15
0
    /// <summary>
    /// 初始化各个业务系统和服务模块,应当先初始化服务后初始化业务
    /// </summary>
    private void Init()
    {
        // 服务模块初始化
        NetSvc net = GetComponent <NetSvc>();

        net.InitSvc();
        ResSvc res = GetComponent <ResSvc>();

        res.InitSvc();
        AudioSvc audio = GetComponent <AudioSvc>();

        audio.InitSvc();
        TimerSvc timer = GetComponent <TimerSvc>();

        timer.InitSvc();

        // 业务模块初始化
        LoginSys login = GetComponent <LoginSys>();

        login.InitSys();
        MainCitySys mainCity = GetComponent <MainCitySys>();

        mainCity.InitSys();
        DungeonSys dungeonSys = GetComponent <DungeonSys>();

        dungeonSys.InitSys();
        BattleSys battleSys = GetComponent <BattleSys>();

        battleSys.InitSys();

        // 显示动态窗口
        dynamicWnd.SetWndState();
        // 进入登录场景并加载相应 UI
        login.EnterLogin();
    }
Пример #16
0
    ///服务初始化
    public void InitSvc()
    {
        instance = this;

        client = new PENet.PESocket <ClientSession, GameMsg>();
        //日志输出设置
        client.SetLog(true, (string msg, int lv) =>
        {
            switch (lv)
            {
            case 0:
                msg = "Log:" + msg;
                Debug.Log(msg);
                break;

            case 1:
                msg = "Warn:" + msg;
                Debug.LogWarning(msg);
                break;

            case 2:
                msg = "Error:" + msg;
                Debug.LogError(msg);
                break;

            case 3:
                msg = "Info:" + msg;
                Debug.Log(msg);
                break;
            }
        });

        client.StartAsClient(SrvCfg.srvIP, SrvCfg.srvPort);
    }
Пример #17
0
 /// <summary>
 /// 初始化Net服务
 /// </summary>
 public void InitSvc()
 {
     instance = this;
     ClientSoc.Connect(new IPEndPoint(IPAddress.Parse(localIp), 5684));
     ClientSoc.BeginReceive(data, 0, data.Length, SocketFlags.None, AsyncReceive, ClientSoc);
     Debug.Log("建立连接");
 }
Пример #18
0
 protected virtual void InitWnd()
 {
     resSvc   = ResSvc.Instance;
     audioSvc = AudioSvc.Instance;
     netSvc   = NetSvc.Instance;
     timerSvc = TimerSvc.Instance;
 }
Пример #19
0
 /// <summary>
 /// 初始化窗口
 /// </summary>
 protected virtual void InitWnd()
 {
     _resSvc   = ResSvc.Instance;
     _audioSvc = AudioSvc.Instance;
     _netSvc   = NetSvc.Instance;
     _timerSvc = TimerSvc.Instance;
 }
Пример #20
0
    private void Init()
    {
        //服务模块初始化
        NetSvc netSvc = GetComponent <NetSvc>();

        netSvc.InitSvc();

        ResSvc res = GetComponent <ResSvc>();

        res.InitSvc();

        AudioSvc audioSvc = GetComponent <AudioSvc>();

        audioSvc.InitSvc();


        //业务系统初始化
        LoginSyc logSyc = GetComponent <LoginSyc>();

        logSyc.InitSys();
        MainCitySyc mainCitySyc = GetComponent <MainCitySyc>();

        mainCitySyc.InitSys();


        //窗口初始化
        //进入登录场景并加载UI
        logSyc.EnterLogin();
    }
Пример #21
0
 public virtual void InitSys()
 {
     Debug.Log("Init SystemRoot...");
     resSvc   = ResSvc.Instance;
     audioSvc = AudioSvc.Instance;
     netSvc   = NetSvc.Instance;
 }
Пример #22
0
    private void Init()
    {
        //服务模块初始化
        NetSvc net = GetComponent <NetSvc>();

        net.InitSvc();
        ResSvc res = GetComponent <ResSvc>();

        res.InitSvc();
        AudioSvc audio = GetComponent <AudioSvc>();

        audio.InitSvc();
        TimerSvc timer = GetComponent <TimerSvc>();

        timer.InitSvc();


        //业务系统初始化
        LoginSys login = GetComponent <LoginSys>();

        login.InitSys();
        MainCitySys maincity = GetComponent <MainCitySys>();

        maincity.InitSys();
        FubenSys fuben = GetComponent <FubenSys>();

        fuben.InitSys();
        BattleSys battle = GetComponent <BattleSys>();

        battle.InitSys();

        //进入登录场景并加载相应UI
        login.EnterLogin();
    }
Пример #23
0
 protected virtual void ClearWindow()
 {
     resSvc   = null;
     audioSvc = null;
     netSvc   = null;
     timeSvc  = null;
 }
Пример #24
0
    public void InitSvc()
    {
        Instance = this;

        client = new PESocket <ClientSession, GameMsg>();
        client.SetLog(true, (string msg, int lv) =>
        {
            switch (lv)
            {
            case 0:
                msg = "log" + msg;
                Debug.Log(msg);
                break;

            case 1:
                msg = "war" + msg;
                Debug.LogWarning(msg);
                break;

            case 2:
                msg = "err" + msg;
                Debug.LogError(msg);
                break;

            case 3:
                msg = "info" + msg;
                Debug.Log(msg);
                break;
            }
        });
        client.StartAsClient(SrvCfg.srvIP, SrvCfg.srvPort);
        PECommon.Log("Init NetSvc...");
    }
Пример #25
0
    public void Init(WeapenCfg weapenCfg)
    {
        switch (weapenCfg.weapenType)
        {
        case "Rifle":
            weapenType = WeapenType.Rifle;
            break;

        case "Sniper":
            weapenType = WeapenType.Sniper;
            break;
        }
        weapenShootRate   = weapenCfg.weapenShootRate;
        weapenReload      = weapenCfg.weapenReload;
        weapenFrontBullet = weapenCfg.weapenFrontBullet;
        weapenBackBullet  = weapenCfg.weapenBackBullet;
        weapenDamage      = weapenCfg.weapenDamage;
        weapenRocoil      = weapenCfg.weapenRocoil;
        weapenRocoilTime  = weapenCfg.weapenRocoilTime;
        BulletPrefab      = weapenCfg.BulletPrefab;
        FireEffect        = weapenCfg.FireEffect;
        ShellEffect       = weapenCfg.ShellEffect;

        CurrentFrontBullet = weapenFrontBullet;
        isFirst            = false;
        CurrentBackBullet  = weapenBackBullet;


        netSvc = NetSvc.Instance;

        Init();
    }
Пример #26
0
 protected virtual void CloseWnd()
 {
     mGameRoot = null;
     mResSvc   = null;
     mAudioSvc = null;
     mNetSvc   = null;
     mCfgSvc   = null;
 }
Пример #27
0
 private void Awake()
 {
     m_Transform   = gameObject.GetComponent <Transform>();
     m_Rigidbody   = gameObject.GetComponent <Rigidbody>();
     m_AudioSource = gameObject.GetComponent <AudioSource>();
     netSvc        = NetSvc.Instance;
     Init();
 }
Пример #28
0
 protected virtual void InitWnd(object[] args = null)
 {
     mGameRoot = GameRoot.Instance;
     mCfgSvc   = CfgSvc.Instance;
     mResSvc   = ResSvc.Instance;
     mAudioSvc = AudioSvc.Instance;
     mNetSvc   = NetSvc.Instance;
 }
Пример #29
0
    public void InitSvc()
    {
        Instance = this;

        session.StartCreate(SrvCfg.srvIP, SrvCfg.srvPort);
        SendAckToServer();

        //接收事件
        session.Client.OnReciveMsgEvent += AddNetPkg;
    }
Пример #30
0
    public virtual void Init()
    {
        Instance = this as T;

        mGameRoot = GameRoot.Instance;
        mCfgSvc   = CfgSvc.Instance;
        mResSvc   = ResSvc.Instance;
        mAudioSvc = AudioSvc.Instance;
        mNetSvc   = NetSvc.Instance;
    }