少年修仙传客户端基础资源
client_Wu Xijin
2018-10-27 58f8d2063b9cf02ff293be7a40cdfe8994da99b5
4340 【前端】支持xlua方便IOS提审
2个文件已修改
4个文件已添加
120 ■■■■■ 已修改文件
Assets/Editor/Config/ExcelToTxt.txt 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Editor/ScriptTemplate/LuaBehaviourTemplate.txt 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Editor/ScriptTemplate/LuaBehaviourTemplate.txt.meta 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Editor/Tool/CreateLuaClassFile.cs 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/TestMonobehaviour.cs 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/TestMonobehaviour.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Editor/Config/ExcelToTxt.txt
@@ -165,3 +165,4 @@
Z.宗门试炼奖励表    TrialRewards
X.仙盟抢Boss表    FairyGrabBoss
P.玩家名屏蔽词    DirtyName
E.恶魔深渊    Abyss
Assets/Editor/ScriptTemplate/LuaBehaviourTemplate.txt
New file
@@ -0,0 +1,11 @@
-- --------------------------------------------------------
--    [Author]:            第二世界
--    [  Date ]:           #DateTime#
-- --------------------------------------------------------
function Start()
end
function Update()
end
Assets/Editor/ScriptTemplate/LuaBehaviourTemplate.txt.meta
New file
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bab7ee850b3c4424daa4339c29336f53
timeCreated: 1505271081
licenseType: Pro
TextScriptImporter:
  userData:
  assetBundleName:
  assetBundleVariant:
Assets/Editor/Tool/CreateLuaClassFile.cs
@@ -71,6 +71,70 @@
}
public class CreateLuaBehaviourClassFile
{
    static string templatePath = "Assets/Editor/ScriptTemplate/LuaBehaviourTemplate.txt";
    [MenuItem("Assets/Create/Lua/LuaBehaviour", false, 4)]
    public static void CreateLuaClass()
    {
        var path = GetSelectedPathOrFallback() + "/NewBehaviour.lua";
        AssetDatabase.DeleteAsset(path);
        ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, ScriptableObject.CreateInstance<LuaBehaviourTemplate>(), path, null, templatePath);
    }
    public static string GetSelectedPathOrFallback()
    {
        string path = "Assets";
        foreach (UnityEngine.Object obj in Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.Assets))
        {
            path = AssetDatabase.GetAssetPath(obj);
            if (!string.IsNullOrEmpty(path) && File.Exists(path))
            {
                path = Path.GetDirectoryName(path);
                break;
            }
        }
        return path;
    }
}
class LuaBehaviourTemplate : EndNameEditAction
{
    public override void Action(int instanceId, string pathName, string resourceFile)
    {
        UnityEngine.Object o = CreateScriptAssetFromTemplate(pathName, resourceFile);
        ProjectWindowUtil.ShowCreatedAsset(o);
    }
    internal static UnityEngine.Object CreateScriptAssetFromTemplate(string pathName, string resourceFile)
    {
        string fullPath = Path.GetFullPath(pathName);
        StreamReader streamReader = new StreamReader(resourceFile);
        string text = streamReader.ReadToEnd();
        streamReader.Close();
        var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(pathName);
        text = Regex.Replace(text, "#ClassName#", fileNameWithoutExtension);
        text = Regex.Replace(text, "#DateTime#", System.DateTime.Now.ToLongDateString());
        bool encoderShouldEmitUTF8Identifier = true;
        bool throwOnInvalidBytes = false;
        UTF8Encoding encoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier, throwOnInvalidBytes);
        bool append = false;
        StreamWriter streamWriter = new StreamWriter(fullPath, append, encoding);
        streamWriter.Write(text);
        streamWriter.Close();
        AssetDatabase.ImportAsset(pathName);
        return AssetDatabase.LoadAssetAtPath(pathName, typeof(UnityEngine.Object));
    }
}
public class CreateLuaConfigClassFile
{
    static string templatePath = "Assets/Editor/ScriptTemplate/LuaConfigTemplate.txt";
Assets/TestMonobehaviour.cs
New file
@@ -0,0 +1,24 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TestMonobehaviour : MonoBehaviour
{
    // Use this for initialization
    void Start()
    {
        CSharpCallLua.Init();
    }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.F))
        {
            CSharpCallLua.OnRecieveLuaNetPackage(41743, new byte[] { 131 });
        }
    }
}
Assets/TestMonobehaviour.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: ecb59add24d616c44b3faccab9597e1e
timeCreated: 1540558111
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant: