Beispiel #1
0
    public void UnRegister(XBoxComponent hero)
    {
        if (hero == null)
        {
            GLog.Log("UNREGISTER a null hero??");
            return;
        }

        if (_heroes.Contains(hero))
        {
            _heroes.Remove(hero);
        }
        else
        {
            GLog.Log("UNREGISTER a ghost hero?? {0}", hero.gameObject.name);
        }

        if (_bloodyHeroes != null)
        {
            XBoxBloody bloodyHero = _bloodyHeroes.Find(delegate(XBoxBloody obj) {
                return(obj.AttackHero == hero);
            });
            GLog.Log("Unregister bloodyHeroes {0}", _bloodyHeroes.Count);
            if (bloodyHero != null)
            {
                _bloodyHeroes.Remove(bloodyHero);
            }
        }
    }
Beispiel #2
0
    public void Init()
    {
        luaEnv.DoString(LuaManager.GetRequireString("LuaSetting"), "LuaSetting");

        //沙盒是不传递到require的文件的,不适用lua使用self
        luaEnv.AddLoader((ref string filepath) =>
        {
            GLog.Log("LuaLoader > " + filepath);
            byte[] buffer = LuaLoader(filepath);
            if (buffer == null || buffer.Length == 0)
            {
                return(null);
            }
            else
            {
#if UNITY_EDITOR
                if (AssetManager.bundleLoadMode)
                {
                    EncryptUtil.Decryption(buffer);
                }
#else
                EncryptUtil.Decryption(buffer);
#endif
                return(buffer);
            }
        });

        GameEvent.SendEvent(GameEventType.LuaManagerReady);
    }
Beispiel #3
0
    public static void GenerateTables()
    {
        try
        {
            Process p          = new Process();
            string  pythonPath = Directory.GetCurrentDirectory();
            p.StartInfo.FileName  = @"python";
            p.StartInfo.Arguments = pythonPath + "/" + ZFGenerator.config.table_pathon_path + "/" + "generate.py";

            p.StartInfo.UseShellExecute = false;
            //p.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory();
            p.StartInfo.RedirectStandardOutput = true;

            p.StartInfo.RedirectStandardInput = true;

            p.StartInfo.RedirectStandardError = true;

            p.StartInfo.CreateNoWindow = false;

            p.Start();
        }
        catch (Exception e0)
        {
            GLog.Log("Generate Tables Exception!" + e0.ToString());
        }
        GLog.Log("Generate Tables finished!");
    }
Beispiel #4
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="confList"></param>
    public static void LoadAsync(string[] confList)
    {
        XRes.LoadMultiAsync(confList, delegate(Object[] objs)
        {
            confPvp = objs[0] as XCameraConfigure;
            if (confPvp)
            {
                confPvp.Initialize();
            }

            confPve = objs[1] as XCameraConfigure;
            if (confPve)
            {
                confPve.Initialize();
            }

            // joy config
            yo  = objs[2] as XCameraYo;
            joy = objs[3] as XCameraYo;

#if UNITY_EDITOR
            foreach (Object obj in objs)
            {
                GLog.Log("[XCameraHelper:LoadAsync] " + obj);
            }
#endif
        });
    }
Beispiel #5
0
    public static void GenerateProtoBuf(string proto_src, string proto_output)
    {
        List <string> protoFiles    = new List <string>();
        string        curWorkingDir = Directory.GetCurrentDirectory();
        string        command       = "-i:";

        GetFiles(ref protoFiles, config.proto_src, "*.proto", "*.meta", config.proto_src);
        for (int i = 0; i < protoFiles.Count; ++i)
        {
            string file     = protoFiles[i];
            int    temp     = file.IndexOf(".proto");
            string fileName = file.Substring(0, temp);

            command += config.proto_src + "/" + file + " ";
            command += "-o:" + config.proto_output_dir + "/" + fileName + ".cs";
            command += " -ns:zf.msg";
            command += " -p:import=zf.core";
            try
            {
                Process          myprocess     = new Process();
                string           protoFileName = config.proto_gentool_dir + "/protogen.exe";
                ProcessStartInfo startInfo     = new ProcessStartInfo(protoFileName, command);
                startInfo.WindowStyle               = ProcessWindowStyle.Hidden;
                startInfo.WorkingDirectory          = curWorkingDir;
                myprocess.StartInfo                 = startInfo;
                myprocess.StartInfo.UseShellExecute = false;
                myprocess.Start();
                GLog.Log("command:" + command);
            }
            catch (Exception e0)
            {
                GLog.Log("启动应用程序时出错!原因:" + e0.Message);
            }
        }
    }
Beispiel #6
0
 public void RefreshFlyPropsInScene(XEffectFlyProp[] flies)
 {
     if (flies != null)
     {
         int len = flies.Length;
         _fliesTransInScene = new Transform[len];
         for (int i = 0; i < flies.Length; i++)
         {
             Transform trans = null;
             if (flies[i] != null)
             {
                 trans = flies[i].flyEffect_.transform;
             }
             else
             {
                 GLog.Log("fly is null in index : " + i.ToString());
             }
             _fliesTransInScene[i] = trans;
         }
     }
     else
     {
         GLog.Log("RefreshFlyPropsInScene  no flies!");
     }
 }
Beispiel #7
0
    public override bool CallHitDetection(List <Transform> transList)
    {
        if (base.CallHitDetection(transList))
        {
            return(true);
        }

        if (_fliesTransInScene != null)
        {
            for (int i = 0; i < _fliesTransInScene.Length; i++)
            {
                if (_fliesTransInScene[i] != null)
                {
                    if (_fliesTransInScene[i] != this.GetFlyEffectTrans())
                    {
                        Transform trans = _fliesTransInScene[i].transform;
                        if (transList.Contains(trans))
                        {
                            if (OnHit(trans))
                            {
                                return(true);
                            }
                        }
                    }
                }
                else
                {
                    GLog.Log("Fly Prop missing??");
                }
            }
        }
        return(false);
    }
Beispiel #8
0
    protected override bool HitDetection()
    {
        if (base.HitDetection())
        {
            return(true);
        }

        if (_fliesTransInScene != null)
        {
            for (int i = 0; i < _fliesTransInScene.Length; i++)
            {
                if (_fliesTransInScene[i] != null)
                {
                    if (_fliesTransInScene[i] != this.GetFlyEffectTrans())
                    {
                        Transform trans = _fliesTransInScene[i].transform;
                        bool      hit   = this.IsIntersect(trans);

                        if (hit)
                        {
                            if (OnHit(trans))
                            {
                                return(true);
                            }
                        }
                    }
                }
                else
                {
                    GLog.Log("Fly Prop missing??");
                }
            }
        }
        return(false);
    }
Beispiel #9
0
    public static void SendEvent(string eventName, params object[] param)
    {
        if (eventName == GameEventType.GameFlow)
        {
            GameFlow gf = (GameFlow)(param[0]);
            GLog.Log("GameFlow:" + (int)gf + " : " + gf.ToString(), Color.yellow);
        }

        List <System.Action <object[]> > evtList;

        if (eventDic.TryGetValue(eventName, out evtList))
        {
            System.Action <object[]>[] evts = evtList.ToArray();
            foreach (System.Action <object[]> evt in evts)
            {
                if (evt != null)
                {
                    try
                    {
                        evt(param);
                    }
                    catch (Exception ex)
                    {
                        GLog.Error(ex.Message + "\n" + ex.StackTrace);
                    }
                }
            }
        }
    }
Beispiel #10
0
    public void Init()
    {
#if UNITY_EDITOR
        if (AssetManager.bundleLoadMode)//编辑器下的Bundle加载模式
        {
            string      manifestPath   = PathUtil.GetAssetPath("patchs");
            AssetBundle manifestbundle = AssetBundle.LoadFromFile(manifestPath);
            manifest = manifestbundle.LoadAsset <AssetBundleManifest>("AssetBundleManifest");
            manifestbundle.Unload(false);
        }
#else
        {
            string      manifestPath   = PathUtil.GetAssetPath("patchs");
            AssetBundle manifestbundle = AssetBundle.LoadFromFile(manifestPath);
            manifest = manifestbundle.LoadAsset <AssetBundleManifest>("AssetBundleManifest");
            manifestbundle.Unload(false);
        }
#endif

        StartCoroutine(LoadAsyncImpl <TextAsset>(PathUtil.GetAssetPath("config_.ab"), "abConfig", (res) =>
        {
            JsonUtility.FromJsonOverwrite(res.text, abConfig);
            GLog.Log("abConfig.data.Count:" + abConfig.data.Count);
            GameEvent.SendEvent(GameEventType.AssetManagerReady);
        }));
    }
Beispiel #11
0
    private static void SetABName(List <string> files, bool setName = true)
    {
        GLog.Log("BuildAssets Count " + files.Count, true);
        for (int i = 0; i < files.Count; i++)
        {
            string        filePath  = files[i];
            string        assetPath = filePath.Substring(Application.dataPath.Length - "assets".Length);
            AssetImporter ai        = AssetImporter.GetAtPath(assetPath);
            GemaEditor.ShowProgress(i, files.Count, "SetAssetLabels", ai.assetPath);

            string abName = AanalyzeAssetLabels(assetPath);

            GLog.Log(string.Format("No.{0} abName:{1} assetPath:{2}", i + 1, abName, assetPath), true);
            if (setName)
            {
                ai.assetBundleName    = abName;
                ai.assetBundleVariant = "ab";
            }
            else
            {
                ai.assetBundleName = null;
                //ai.assetBundleVariant = null;
            }

            string fileName = Path.GetFileName(ai.assetPath);
            fileName = fileName.Split('.')[0];
            string importerName = ai.GetType().ToString().Split('.')[1];
            string typename     = importerName.Substring(0, importerName.Length - 8);

            List <string> listAsset;
            if (!typeAssets.TryGetValue(typename, out listAsset))
            {
                listAsset = new List <string>();
                typeAssets.Add(typename, listAsset);
            }

            if (listAsset.IndexOf(fileName) != -1)
            {
                GLog.Error("Repeat name " + fileName + " type " + typename, true);
                return;
            }
            listAsset.Add(fileName);


            ABConfigInfo abConfigInfo = abConfig.GetInfoByAB(abName);
            if (abConfigInfo == null)
            {
                abConfigInfo = new ABConfigInfo();
                abConfig.AddInfo(abConfigInfo);
                resourceCount++;
                abConfigInfo.id   = resourceCount;
                abConfigInfo.ab   = abName;
                abConfigInfo.type = typename;
            }
            abConfigInfo.names.Add(fileName);
        }
        EditorUtility.ClearProgressBar();
    }
Beispiel #12
0
 public static Array BytesToArray(byte[] buffer, Type elemType)
 {
     using (MemoryStream stream = new MemoryStream(buffer))
     {
         BinaryReader reader = new BinaryReader(stream);
         Array        arg;
         try
         {
             int rank = reader.ReadByte();
             if (rank == 1)
             {
                 List <object> list = new List <object>();
                 while (!reader.IsReadOver())
                 {
                     object obj = default(object);
                     Serializer.Read(reader, elemType, ref obj);
                     list.Add(obj);
                 }
                 arg = Array.CreateInstance(elemType, list.Count);
                 for (int i = 0, max = list.Count; i < max; ++i)
                 {
                     arg.SetValue(list[i], i);
                 }
             }
             else
             {
                 object dimensionO = default(object);
                 Serializer.Read(reader, typeof(byte[]), ref dimensionO);
                 byte[] dimensions     = (byte[])dimensionO;
                 long[] tempDimensions = new long[dimensions.Length];
                 for (int i = 0, max = dimensions.Length; i < max; ++i)
                 {
                     tempDimensions[i] = (long)dimensions[i];
                 }
                 arg = Array.CreateInstance(elemType, tempDimensions);
                 while (!reader.IsReadOver())
                 {
                     object obj = default(object);
                     Serializer.Read(reader, typeof(int[]), ref obj);
                     int[] posIndex = (int[])obj;
                     obj = default(object);
                     Serializer.Read(reader, elemType, ref obj);
                     arg.SetValue(obj, posIndex);
                 }
             }
             return(arg);
         }
         catch (Exception e)
         {
             GLog.Log(e.ToString());
         }
         finally
         {
             reader.Close();
         }
         return(null);
     }
 }
Beispiel #13
0
 /// <summary>
 /// Unloads the unused assets.
 /// </summary>
 /// <returns>The unused assets.</returns>
 private static AsyncOperation UnloadUnusedAssets()
 {
     if ((cleanupTask == null) || cleanupTask.isDone)
     {
         GLog.Log("[XRes.UnloadUnusedAssets] Running cleanup task");
         cleanupTask = Resources.UnloadUnusedAssets();
     }
     return(cleanupTask);
 }
    private void OnPreprocessTexture()
    {
        return;

        //SetAllTexture也可以做到批量设置图片
        TextureImporter ti = this.assetImporter as TextureImporter;

        GLog.Log("OnPreprocessTexture:" + ti.assetPath);
    }
Beispiel #15
0
 public void Init()
 {
     GLog.Log("Application.platform " + Application.platform);
     if (Application.platform == RuntimePlatform.Android)
     {
         AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
         jo = jc.GetStatic <AndroidJavaObject>("currentActivity");
     }
 }
Beispiel #16
0
    /// <summary>
    /// Loads the script.
    /// </summary>
    /// <returns>The script.</returns>
    /// <param name="fn">Fn.</param>
    public static byte[]    LoadScript(string fn, ref string str)
    {
        fn = fn.Replace(".", "/");

#if UNITY_STANDALONE || UNITY_EDITOR
        XBufferAsset asset = ScriptableObject.CreateInstance <XBufferAsset>();

        // find config source code
        string filePath = System.IO.Path.Combine(Application.dataPath, string.Format("Config/{0}.lua", fn));
        if (!System.IO.File.Exists(filePath))
        {
            // find logic script
            filePath = System.IO.Path.Combine(Application.dataPath, string.Format("Code/Script/{0}.lua", fn));
            if (!System.IO.File.Exists(filePath))
            {
                string bytefn = fn.Replace("/", "@").ToLower();
                // find lua byte code
                filePath = System.IO.Path.Combine(Application.dataPath,
                                                  string.Format("Bytecode/{0}/{1}.bytes", platformPath, bytefn));
            }
        }

#if !RELEASE
        GLog.Log(string.Format("{0}", filePath));
#endif

        if (System.IO.File.Exists(filePath))
        {
            System.IO.FileStream fs = System.IO.File.OpenRead(filePath);
            asset.init((int)fs.Length);
            fs.Read(asset.bytes, 0, (int)fs.Length);
            fs.Close();

            return(asset.bytes);
        }
        else
        {
            Debug.LogError("can't find file : " + filePath);
        }
#else
        string bytefn = fn.Replace("/", "@").ToLower();
        string hashfn = XUtility.Md5Sum(string.Format("{0}/{1}",
                                                      platformPath, bytefn));

        XBufferAsset asset = XBytecodeFilePicker.LoadBytecodeAsset(string.Format("bytecode/{0}", hashfn));
        if (asset != null)
        {
            return(asset.bytes);
        }
        else
        {
            Debug.LogError("Can't load bytecode " + platformPath + " " + bytefn);
        }
#endif
        return(null);
    }
Beispiel #17
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="cacheType"></param>
    private void ReleaseBundle(XSheet.XCacheType cacheType)
    {
        float now = Time.time;

        for (int i = 0; i < allInfo.Count; i++)
        {
            XAssetBundleInfo info = allInfo[i];
            if (info.isDone && info.Unused(now))
            {
                if (info.pack.cacheType != cacheType && info.pack.cacheType != XSheet.XCacheType.None)
                {
                    continue;
                }
#if !RELEASE
                if (info.Ref() < 0)
                {
                    GLog.LogError("XAssetManager.Unload bundle:{0} refCount({1}) incorrect!", info.pack.name, info.Ref());
                }
#endif

                info.ResetRef();

                for (int depIndex = 0; depIndex < info.pack.dependencies.Length; depIndex++)
                {
                    string           dependence     = info.pack.dependencies[depIndex];
                    XAssetBundleInfo dependenceInfo = GetAssetBundleInfo(dependence);
                    if (dependenceInfo != null)
                    {
                        dependenceInfo.RemoveDepended(info.pack.name);
                    }
                }
            }
        }

        for (int i = 0; i < allInfo.Count; i++)
        {
            XAssetBundleInfo info = allInfo[i];
            if (info.isDone && info.Unused(now))
            {
                if (info.pack.cacheType != cacheType && info.pack.cacheType != XSheet.XCacheType.None)
                {
                    continue;
                }

                if (info.DependedCount() == 0)
                {
                    info.bundle.Unload(false);
                    info.bundle = null;
                    info.isDone = false;

                    GLog.Log("AssetManager.UnloadAssetBundle bundle:{0} unloaded ref:{1} cache type: {2}",
                             info.pack.name, info.Ref(), info.pack.cacheType.ToString());
                }
            }
        }
    }
Beispiel #18
0
 void OnApplicationQuit()
 {
     GLog.Log("Destroy Singleton");
     if (m_Container != null)
     {
         GameObject.Destroy(m_Container);
         m_Container    = null;
         m_IsDestroying = true;
     }
 }
Beispiel #19
0
    public void OnAnimatorStateExit(int state, int tag)
    {
#if UNITY_EDITOR
        GLog.Log(string.Format("<color=orange> OnAnimatorStateExit state=%d tag=%d </color>", state, tag));
#endif
        if (m_luaAnimatorStateExit != null)
        {
            m_luaAnimatorStateExit.call(LuaModule, state, tag);
        }
    }
    /// <summary>
    ///  生成bundlefiles
    /// </summary>
    //[@MenuItem(kGenerateAssetBundleFiles, false, 2051)]
    public static void GenerateFiles()
    {
        string bundlefilesPath = Path.Combine(bundlesPath, bundlefilesName);

        List <string> files = FindAllFiles.ListFiles(bundlesPath, true);

        List <string> record = new List <string>();

        for (int i = 0; i < files.Count; i++)
        {
            string filePath = files[i];
            string ext      = Path.GetExtension(filePath);
            string name     = Path.GetFileName(filePath);

            if (ext.Equals(".meta") || ext.Equals(".manifest"))
            {
                continue;
            }

            if (ext.Equals(".ab") || ext.Equals("") || name.Contains("patchs"))
            {
                GLog.Log(name);

                byte[] fileByte = File.ReadAllBytes(filePath);

                string md5 = MD5Util.MD5(fileByte);

                int size = fileByte.Length;

                string relativePath = filePath.Replace(bundlesPath, string.Empty).Trim();

                StringBuilder sb = new StringBuilder();
                sb.Append(relativePath);
                sb.Append("|");
                sb.Append(md5);
                sb.Append("|");
                sb.Append(size);
                record.Add(sb.ToString());
            }
        }

        FileStream   fs = new FileStream(bundlefilesPath, FileMode.Create);
        StreamWriter sw = new StreamWriter(fs);

        for (int i = 0; i < record.Count; i++)
        {
            string value = record[i];
            sw.WriteLine(value);
        }
        sw.Close();
        fs.Close();

        AssetDatabase.Refresh();
    }
Beispiel #21
0
 public void PrintMessage(IMessage message)
 {
     if (GLog.isOpen)
     {
         var descriptor = message.Descriptor;
         foreach (var field in descriptor.Fields.InDeclarationOrder())
         {
             GLog.Log(string.Format("Field {0} ({1}): {2}", field.FieldNumber,
                                    field.Name,
                                    field.Accessor.GetValue(message)));
         }
     }
 }
Beispiel #22
0
    private void CompareLocalAndRemotePatchFiles()
    {
        needLoadPatchFiles = new Queue <PatchFileInfo>();
        refreshPatchFiles  = new PatchFiles();

        needLoadSize = 0;
        foreach (PatchFileInfo remotePatchFileInfo in remotePatchFiles.dic.Values)
        {
            if (!localPatchFiles.dic.ContainsKey(remotePatchFileInfo.ResPath))
            {//新增文件
                needLoadSize += remotePatchFileInfo.Size;
                needLoadPatchFiles.Enqueue(remotePatchFileInfo);
            }
            else if (localPatchFiles.dic[remotePatchFileInfo.ResPath].Md5 != remotePatchFileInfo.Md5)
            {//修改文件
                needLoadSize += remotePatchFileInfo.Size;
                needLoadPatchFiles.Enqueue(remotePatchFileInfo);
            }
            else
            {//同样文件
                //refreshPatchFiles.Add(remotePatchFileInfo);
                needLoadSize += remotePatchFileInfo.Size;
                needLoadPatchFiles.Enqueue(remotePatchFileInfo);
            }
        }

        refreshPatchFiles.FileReplace(PathUtil.LocalPatchFilesPath());

        float needLoadSizeM = needLoadSize / (1024 * 1024);

        GLog.Log("needLoadSizeM " + needLoadSizeM + " Count " + needLoadPatchFiles.Count, Color.red);
        if (needLoadPatchFiles.Count > 0)
        {//如果下载列表不为空
            if (NetworkUtil.GetNetworkType() == NetworkType.Wifi)
            {
            }
            else
            {
                if (needLoadSizeM > 5f)
                {
                    //大于5m用户提醒
                }
            }

            HttpPatch();
        }
        else
        {
            PatchComplete();
        }
    }
Beispiel #23
0
    public static void GenerateProtoBuf()
    {
        Console.WriteLine(Environment.OSVersion.Platform);
        if (config.genFramework)
        {
            GenerateProtoBuf(config.proto_src, config.proto_output_dir);
        }

        if (config.batch != null)
        {
            GenerateProtoBuf(config.batch.proto_src, config.batch.proto_output_dir);
        }

        GLog.Log("Generate ProtoBuf finished!");
    }
Beispiel #24
0
 void initEffectAudio()
 {
     for (int i = 0; i < audioClips.Count; ++i)
     {
         if (audioClips[i].audioClip != null)
         {
             GameObject audioCom = Instantiate <GameObject>(audioClips[i].audioClip);
             audioCom.transform.SetParent(gameObject.transform);
             audioCom.GetComponent <XAudioComponent>().autoDeactive = false;
         }
         else
         {
             GLog.Log(string.Format("<color=orange>Effect lose audio prefab</color>"));
         }
     }
 }
Beispiel #25
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="bundleInfo"></param>
    /// <param name="loadDependence"></param>
    /// <returns></returns>
    private IEnumerator LoadAssetBundleAsync(XAssetBundleInfo bundleInfo, bool loadDependence = true)
    {
        while (bundleInfo.isLoading)
        {
            yield return(null);
        }

        if (bundleInfo.isDone)
        {
            yield break;
        }

        GLog.Log("XBundleManager.LoadAssetBundleAsync {0}", bundleInfo.url);

        bundleInfo.isLoading = true;
        if (loadDependence)
        {
            yield return(XCoroutine.Run(LoadDependenciesAsync(bundleInfo.pack)));
        }

        string bundleName = bundleInfo.pack.name;
        AssetBundleCreateRequest loader = AssetBundle.LoadFromFileAsync(bundleInfo.url);

        yield return(loader);

        if (!loader.isDone)
        {
            bundleInfo.isLoading = false;
            GLog.LogError("XBundleManager.LoadAssetBundle can't async load bundle: {0} reason: {1}",
                          bundleName, "NOT FOUND!");
        }
        else
        {
            bundleInfo.isLoading = false;
            if (loader.assetBundle != null)
            {
                bundleInfo.bundle = loader.assetBundle;
                bundleInfo.isDone = true;
                GLog.Log("XBundleManager.LoadAssetBundle async load done bundle: {0}", bundleName);
            }
            else
            {
                GLog.LogError("AssetBundleManager.LoadAssetBundle can't async load bundle: {0}", bundleName);
            }
        }
    }
Beispiel #26
0
    public static void GenerateCode()
    {
        GTypeManager.Instance.Clear();
        LoadTypeDefs();

        // generate code
        if (config.genFramework)
        {
            string frameCode1;
            GTypeManager.Instance.GenCode_CS_Head(out frameCode1, null);
            if (!Directory.Exists(config.cs_output_dir))
            {
                Directory.CreateDirectory(config.cs_output_dir);
            }
            File.WriteAllText(Path.Combine(config.cs_output_dir, "Templates.cs"), frameCode1);

            string frameCode2;
            GTypeManager.Instance.GenCode_CS_Impl(out frameCode2, null);
            File.WriteAllText(Path.Combine(config.cs_output_dir, "Templates_impl.cs"), frameCode2);

            string frameCode3;
            GTypeManager.Instance.GenCode_CS_Binding(out frameCode3, null);
            File.WriteAllText(Path.Combine(config.cs_output_dir, "Templates_binding.cs"), frameCode3);
        }

        if (config.batch != null)
        {
            string code;
            GTypeManager.Instance.GenCode_CS_Head(out code, config.batch);
            if (!Directory.Exists(config.batch.cs_output_dir))
            {
                Directory.CreateDirectory(config.batch.cs_output_dir);
            }
            File.WriteAllText(Path.Combine(config.batch.cs_output_dir, "Templates.cs"), code);

            string code2;
            GTypeManager.Instance.GenCode_CS_Impl(out code2, config.batch);
            File.WriteAllText(Path.Combine(config.batch.cs_output_dir, "Templates_impl.cs"), code2);

            string code3;
            GTypeManager.Instance.GenCode_CS_Binding(out code3, config.batch);
            File.WriteAllText(Path.Combine(config.batch.cs_output_dir, "Templates_binding.cs"), code3);
        }

        GLog.Log("Generate code finished!");
    }
Beispiel #27
0
    void OnAnimationBackwardEnd(AnimationEvent evt)
    {
#if UNITY_EDITOR
        GLog.Log(string.Format("<color=orange> OnAnimationBackwardEnd func={0} int={1} float={2} string={3} </color>",
                               evt.functionName, evt.intParameter, evt.floatParameter, evt.stringParameter));
#endif
        if (m_luaAnimationDispatchEvent != null)
        {
            m_frameAnimationEvents.Add(evt);
        }
        else
        {
            if (m_luaAnimationBackwardEnd != null)
            {
                m_luaAnimationBackwardEnd.call(LuaModule, evt, evt.objectReferenceParameter as XBodyBoxConfigObject);
            }
        }
    }
Beispiel #28
0
    void OnAnimationAttackStart(AnimationEvent evt)
    {
#if UNITY_EDITOR
        GLog.Log(string.Format("<color=orange> OnAnimationAttackStart func={0} int={1} float={2} string={3} </color>",
                               evt.functionName, evt.intParameter, evt.floatParameter, evt.stringParameter));
#endif
        if (m_luaAnimationDispatchEvent != null)
        {
            m_frameAnimationEvents.Add(evt);
        }
        else
        {
            if (m_luaAnimationAttackStart != null)
            {
                m_luaAnimationAttackStart.call(LuaModule, evt);
            }
        }
    }
Beispiel #29
0
    private void Awake()
    {
        uiRootT = Game.Instance.canvasTrans.Find("UIRoot").transform;

        string[] uiLayerNames = Enum.GetNames(typeof(UIType));
        for (int i = 0; i < uiLayerNames.Length; i++)
        {
            string        uiLayerName  = uiLayerNames[i];
            GameObject    uiLayer      = new GameObject();
            RectTransform rectTranform = uiLayer.AddComponent <RectTransform>();
            rectTranform.anchorMin = new Vector2();
            rectTranform.anchorMax = new Vector2(1, 1);
            rectTranform.sizeDelta = new Vector2();
            GLog.Log(rectTranform.rect.ToString());
            uiLayer.transform.SetParent(uiRootT, false);
            uiLayer.name = uiLayerName;
            uiLayers.Add(uiLayer.transform);
        }
    }
Beispiel #30
0
    private void LoadRemotePatchFiles()
    {
        GameEvent.SendEvent(GameEventType.GameFlow, GameFlow.PatchFileRemoteLoad);
        remotePatchFiles = new PatchFiles();
        string remotePatchFilesPath = PathUtil.RemotePatchFilesPath();

        GLog.Log("remotePatchFilesPath " + remotePatchFilesPath);
        if (File.Exists(remotePatchFilesPath))
        {
            HttpManager.Instance.LoadText(remotePatchFilesPath, (res) =>
            {
                remotePatchFiles.Load(res);
                CompareLocalAndRemotePatchFiles();
            });
        }
        else
        {
            GLog.Error(string.Format("{0} is null", remotePatchFilesPath), true);
        }
    }