CommonScript.cs

/*
 * This file contains script types and methods
 * that are common to all collection templates.
 */

public enum AccessibilityEnum {
    Public,
    Protected,
    Internal,
    ProtectedInternal,
    Private
}

public string GetAccessModifier(AccessibilityEnum accessibility) {
    switch (accessibility) {
        case AccessibilityEnum.Public:            return "public";
        case AccessibilityEnum.Protected:         return "protected";
        case AccessibilityEnum.Internal:          return "internal";
        case AccessibilityEnum.ProtectedInternal: return "protected internal";
        case AccessibilityEnum.Private:           return "private";
        default:                                  return "public";
    }
}

public bool IsInt32(string type) {
    if (type == null || type.Length == 0) return false;
    type = type.ToLower();
    return (type == "int" || type == "integer" || type == "int32"
        || type == "system.int32" || type == "::system.int32");
}

public bool IsString(string type) {
    if (type == null || type.Length == 0) return false;
    type = type.ToLower();
    return (type == "string" || type == "system.string"
        || type == "::system.string");
}

private System.Collections.Specialized.StringCollection
    _namespaces = new System.Collections.Specialized.StringCollection();

public void UsingNamespace(string ns) {
    if (!IncludeNamespaces) return;
    if (ns == null || ns.Length == 0) return;
    if (_namespaces.Contains(ns)) return;

    if (_namespaces.Count == 0) Response.WriteLine();
    Response.WriteLine("using " + ns + ";");
    _namespaces.Add(ns);
}

public void StartNamespace(string ns) {
    if (!IncludeNamespaces) return;
    if (ns == null || ns.Length == 0) return;
    Response.WriteLine();
    Response.WriteLine("namespace " + ns + " {");
}

public void EndNamespace(string ns) {
    if (!IncludeNamespaces) return;
    if (ns == null || ns.Length == 0) return;
    Response.WriteLine("}");
}

public CodeTemplate GenerateInterfaces(string file) {
    CodeTemplate template = GetCodeTemplateInstance(file);
    if (template == null) return null;

    CopyPropertiesTo(template);
    template.SetProperty("IncludeNamespaces", false);
    template.Render(Response);

    return template;

lua报错nil nil error! c# exception:XLua.LuaException: c# exception:UnityEngine.MissingComponentException: There is no 'MeshRenderer' attached to the "ch_architect" game object, but a script is trying to access it. You probably need to add a MeshRenderer to the game object "ch_architect". Or your script needs to check if the component is attached before using it. at (wrapper managed-to-native) UnityEngine.Renderer.set_sortingLayerName(UnityEngine.Renderer,string) at XLua.CSObjectWrap.UnityEngineRendererWrap._s_set_sortingLayerName (System.IntPtr L) [0x0001c] in D:\DreamLandProjects\DreamLandc301\Assets\XLua\Gen\UnityEngine_RendererWrap.cs:1040 stack traceback: [C]: in ? [C]: in ? [C]: in metamethod '__newindex' Common/UI/UIASpine:136: in function 'Common/UI/UIASpine.SetSort' UI/Hero/UITeamItems:299: in upvalue 'CB' Common/Unit/SingleChild:179: in upvalue 'CB' Common/Unit/SingleChild:102: in upvalue 'CB' Common/UI/UIItem:45: in upvalue 'CB' Common/Unit/Unit:100: in upvalue 'CB' Common/UI/UIASpine:26: in function <Common/UI/UIASpine:22> ... UI/Hero/UITeamItems:296: in field 'fReset' Common/UI/UIUnit:53: in function 'Common/UI/UIUnit.Reset' UI/Team/UITeamMain:326: in function 'UI/Team/UITeamMain.UpdateSlots' UI/Team/UITeamMain:311: in function 'UI/Team/UITeamMain.UpdateTeamBtns' UI/Team/UITeamMain:49: in function 'UI/Team/UITeamMain.OnEnter' [C]: in function 'xpcall' InitLib:63: in function 'xpcall_0' UI/Common/UIManager:141: in function 'UI/Common/UIManager.EnterPanel' UI/Common/UIManager:114: in function 'UI/Common/UIManager.OpenPanel' UI/Common/UIManager:189: in upvalue 'LoadedCB' UI/Common/UIManager:610: in function <UI/Common/UIManager:574>
06-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值