// Token: 0x060004A0 RID: 1184 RVA: 0x00014EEC File Offset: 0x000130EC
        public LuaProtobufExtensionTypeInfo(string typeName, LuaTable typeDef, LuaProtoBufExtensionHandler handler)
        {
            this.m_typeName = typeName;
            this.m_typeDef  = typeDef;
            this.m_handler  = handler;
            this.m_typeCode = LuaProtobufExtensionTypeInfo.GetTypeCode(typeName);
            if (LuaProtobufExtensionTypeInfo.IsSystemType(this.m_typeCode))
            {
                return;
            }
            this.m_isExtension             = typeDef.RawGet <bool>("IsExtension");
            this.m_isEnum                  = typeDef.RawGet <bool>("IsEnum");
            this.m_hasExtension            = typeDef.RawGet <bool>("HasExtension");
            this.m_hasExtensionInHierarchy = typeDef.RawGet <bool>("HasExtensionInHierarchy");
            LuaTable luaTable = typeDef.RawGet("MemberList") as LuaTable;

            if (luaTable == null)
            {
                throw new ApplicationException("LuaProtobufExtensionTypeInfo() MemberList miss " + typeName);
            }
            foreach (LuaTable.TablePair tablePair in luaTable)
            {
                string   text         = tablePair.key as string;
                LuaTable memberDefine = tablePair.value as LuaTable;
                LuaProtobufExtensionTypeMemberInfo value = new LuaProtobufExtensionTypeMemberInfo(text, memberDefine, handler);
                this.m_memberDict.Add(text, value);
            }
        }
        // Token: 0x06000492 RID: 1170 RVA: 0x0001480C File Offset: 0x00012A0C
        public static LuaProtoBufExtensionHandler Create()
        {
            LuaProtoBufExtensionHandler luaProtoBufExtensionHandler = new LuaProtoBufExtensionHandler();

            if (!luaProtoBufExtensionHandler.Init())
            {
                return(null);
            }
            ProtobufExensionHelper.SetHandler(luaProtoBufExtensionHandler);
            return(luaProtoBufExtensionHandler);
        }
Example #3
0
        public IEnumerator StartLuaSvr(Action <bool> onComplete)
        {
            if (ResourceManager.Instance.State != ResourceManager.RMState.AssetBundleManifestLoadEnd)
            {
                global::Debug.LogError("StartLuaSvr fail ResourceManager not ready");
                onComplete(false);
                yield break;
            }
            string      initModulePath  = this.GetModulePath(this.m_luaInitModuleName);
            TextAsset   initModuleAsset = null;
            IEnumerator iter            = ResourceManager.Instance.LoadAsset <TextAsset>(initModulePath, delegate(string lpath, TextAsset lasset)
            {
                initModuleAsset = lasset;
            }, false, false);

            yield return(iter);

            if (initModuleAsset == null)
            {
                global::Debug.LogError("StartLuaSvr fail load initModuleAsset fail");
                onComplete(false);
                yield break;
            }
            ResourceManager.Instance.MakeAssetBundleDontUnload(initModulePath);
            this.m_luaSvr = new LuaSvr();
            LuaSvr.mainState.loaderDelegate = new LuaState.LoaderDelegate(this.LuaLoader);
            this.m_luaSvr.init(null, delegate
            {
                if (!string.IsNullOrEmpty(this.m_luaInitModuleName))
                {
                    this.m_luaSvr.start(this.m_luaInitModuleName);
                }
                this.m_luaProtoBufExtensionHandler = LuaProtoBufExtensionHandler.Create();
                DummyType.InitLuaModule(LuaSvr.mainState);
            }, LuaSvrFlag.LSF_EXTLIB);
            onComplete(true);
            yield break;
        }
        // Token: 0x06000494 RID: 1172 RVA: 0x00014938 File Offset: 0x00012B38
        public IProtobufExtensionTypeInfo GetExtTypeInfo(string typeName)
        {
            LuaProtobufExtensionTypeInfo luaProtobufExtensionTypeInfo;

            if (this.m_typeInfoDict.TryGetValue(typeName, out luaProtobufExtensionTypeInfo))
            {
                return(luaProtobufExtensionTypeInfo);
            }
            if (LuaProtoBufExtensionHandler.IsSystemType(typeName))
            {
                luaProtobufExtensionTypeInfo = new LuaProtobufExtensionTypeInfo(typeName, null, this);
            }
            else
            {
                LuaTable luaTypeDefine = this.GetLuaTypeDefine(typeName);
                if (luaTypeDefine == null)
                {
                    return(null);
                }
                luaProtobufExtensionTypeInfo = new LuaProtobufExtensionTypeInfo(typeName, luaTypeDefine, this);
            }
            this.m_typeInfoDict.Add(typeName, luaProtobufExtensionTypeInfo);
            return(luaProtobufExtensionTypeInfo);
        }
Example #5
0
 // Token: 0x060004B2 RID: 1202 RVA: 0x0001539C File Offset: 0x0001359C
 public LuaProtobufExtensionTypeMemberInfo(string memberName, LuaTable memberDefine, LuaProtoBufExtensionHandler handler)
 {
     this.m_handler      = handler;
     this.m_memberName   = memberName;
     this.m_memberDefine = memberDefine;
     this.m_tag          = Convert.ToInt32(this.m_memberDefine.RawGet("Tag"));
     this.m_enumValue    = Convert.ToInt32(this.m_memberDefine.RawGet("Value"));
     this.m_typeName     = this.m_memberDefine.RawGet <string>("TypeName");
     this.m_isExtension  = this.m_memberDefine.RawGet <bool>("IsExtension");
     this.m_dataFormat   = (DataFormat)Enum.Parse(typeof(DataFormat), this.m_memberDefine.RawGet <string>("DataFormat"), true);
     this.m_isRequire    = this.m_memberDefine.RawGet <bool>("IsRequire");
     this.m_isRepeated   = this.m_memberDefine.RawGet <bool>("IsRepeated");
 }