Esempio n. 1
0
    void GlobalInit()
    {
        Screen.sleepTimeout = SleepTimeout.NeverSleep;
#if UNITY_STANDALONE_WIN
        DllTest.GetProcessWnd();
#endif
        try
        {
            //全局的初始化
            LogMgr.GlobalInit();
            Utility.GlobalInit();
            RuntimeInfo.GlobalInit();
            SDKMgr.Instance.GlobalPreInit();

            Resolution.GlobalInit();
            StringTable.GlobalInit();
            SceneObjMgr.Instance.GlobalInit();
            ResManager.Instance.GlobalInit();   //Res需要在SDKMgr的前面。
            //ReportException.Instance.GlobalInit();
            SDKMgr.Instance.GlobalInit();
            ServerSetting.GlobalInit();

            GlobalUpdate.GlobalInit();
            NetCmdMapping.GlobalInit();
            LogicManager.Instance.GlobalInit();
            UICamera.onPress = OnPress;
            Utility.GlobalInit();
        }
        catch (System.Exception e)
        {
            ReportException.Instance.AddException(e.ToString());
        }
    }
Esempio n. 2
0
 public static bool CheckCmdType(NetCmdType cmdType)
 {
     if (NetCmdMapping.IsRegisterCmd(cmdType))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Esempio n. 3
0
 void Start()
 {
     Instance = this;
     ModelManager.Instance.Register <LoginModel>();
     ModelManager.Instance.Register <BagModel>();
     ModelManager.Instance.Register <ShopModel>();
     GF.Resolution.GlobalInit();
     NetCmdMapping.GlobalInit();
     DontDestroyOnLoad(this);
     UIManager.Instance.ShowView <LogonLoadResView>();
 }
Esempio n. 4
0
    public static NetCmdBase ByteToCmd(byte[] byteData, int offset, int length)
    {
        if (length < 4)
        {
            return(null);
        }
        int t1 = (int)byteData[offset + 3];
        int t2 = (int)byteData[offset + 2];

        t1 = t1 << 8 | t2;

        NetCmdType cmdType = (NetCmdType)(t1);

        if (cmdType >= NetCmdType.CMD_MAX)
        {
            return(null);
        }
        NetTypeInfo typeInfo = NetCmdMapping.GetTypeInfo(cmdType);

        if (typeInfo == null)
        {
            LogMgr.Log("未注册的命令:" + cmdType.ToString());
            return(null);
        }
        if (length < typeInfo.StructSize)
        {
            LogMgr.Log("命令大小与结构体大小不匹配:" + length.ToString() + " : " + typeInfo.StructSize.ToString() + " :" + cmdType.ToString());
            return(null);
        }
        NetCmdBase cmd = (NetCmdBase)TypeReflector.BytesToObj(
            typeInfo.TypeHashCode,
            byteData,
            offset,
            length
            );

        return(cmd);
    }