Log() публичный статический Метод

public static Log ( object message ) : void
message object
Результат void
Пример #1
0
 public static SearchQueryModel Parse(string input)
 {
     if (string.IsNullOrEmpty(input))
     {
         return(new SearchQueryModel());
     }
     try
     {
         var res = JsonConvert.DeserializeObject <SearchQueryModel>(input);
         return(res);
     }
     catch (Exception e) { Debugger?.Log(e.Message); }
     return(ParseQuery(input));
 }
Пример #2
0
        public void Build(List <ContentServer.FlowCommand> pageInstructions)
        {
            sb.Clear();

            sb.AppendLine("<html>");
            sb.AppendLine("<head><title></title>");
            sb.AppendLine("<script type=\"text/javascript\" src=\"{%homedir}/shh.js\"></script>");
            sb.AppendLine("<link rel=\"stylesheet\" type=\"text/css\" href=\"{%homedir}/{%current_theme}\">");
            sb.AppendLine("</head>");
            sb.AppendLine("<body style='padding-left:32px;padding-right:32px'>");

            foreach (ContentServer.FlowCommand cmd in pageInstructions)
            {
                if (cmd.Command.Equals("h1"))
                {
                    stopScript();
                    stopTable();
                    sb.AppendFormat("<h1>{0}</h1>", cmd.getArg(0));
                }
                else if (cmd.Command.Equals("choice"))
                {
                    if (!bTableStarted)
                    {
                        sb.AppendLine("<table width=100% cellpadding=8 cellspacing=6>");
                        bTableStarted = true;
                    }
                    sb.AppendLine("<tr height=32px><td class='choice'");
                    sb.AppendFormat(" onmouseover='shh(1,\"t{0}\")' ", cid);
                    sb.AppendFormat(" onmouseout='shh(0,\"t{0}\")'", cid);
                    sb.AppendFormat(" onclick='runAction(\"{0}\")' id='t{1}'>", cmd.getArgSubst(1, contentServer.getProperties(), true), cid);
                    sb.AppendLine(cmd.getArg(0));
                    sb.AppendLine("</td></tr>");
                    cid++;
                }
                else if (cmd.Command.Equals("list"))
                {
                    if (cmd.getArg(0).Equals("start"))
                    {
                        sb.AppendFormat("<table style='border:0px' align=center width='66%' cellpadding=4 cellspacing=4>");
                        bTableStarted = true;
                    }
                    else if (cmd.getArg(0).Equals("end"))
                    {
                        stopScript();
                        sb.AppendFormat("</table>\n");
                    }
                }
                else if (cmd.Command.Equals("set"))
                {
                    string a = cmd.getArg(0);
                    string b = cmd.getArg(1);

                    if (a.Length > 0)
                    {
                        properties[a] = b;
                    }
                }
                else if (cmd.Command.Equals("clickchoice"))
                {
                    string myText = cmd.getArg(0);
                    string myId   = cmd.getArg(1);

                    if (!bScriptStarted)
                    {
                        sb.AppendLine("<script>");
                        bScriptStarted = true;
                    }
                    sb.AppendFormat("writeClickChoiceValue(\"");
                    sb.Append(contentServer.evaluate3params("getSelectionText", properties["property"], myId));
                    sb.AppendFormat("\", \"{0}\", \"{1}\", ", myText, myId);
                    sb.Append(contentServer.evaluate3params("isSelectedSetting", properties["property"], myId));
                    sb.Append(", \"");
                    sb.Append(properties["returnpage"]);
                    sb.Append("\", \"");
                    sb.Append(properties["property"]);
                    sb.AppendLine("\");");
                }
            }

            stopScript();
            stopTable();

            sb.AppendLine("</body>");
            sb.AppendLine("</html>");

            Debugger.Log(0, "", sb.ToString());
        }
Пример #3
0
    public static void Bind(LuaState L)
    {
        float t = Time.realtimeSinceStartup;

        L.BeginModule(null);
        DebuggerWrap.Register(L);
        LuaBehaviourWrap.Register(L);
        GameResFactoryWrap.Register(L);
        BaseWrap.Register(L);
        ManagerWrap.Register(L);
        ByteBufferWrap.Register(L);
        NetworkManagerWrap.Register(L);
        LuaHelperWrap.Register(L);
        LeanTweenTypeWrap.Register(L);
        LTDescrImplWrap.Register(L);
        LTBezierWrap.Register(L);
        LTBezierPathWrap.Register(L);
        LTEventWrap.Register(L);
        LTSplineWrap.Register(L);
        LeanTweenWrap.Register(L);
        LeanAudioWrap.Register(L);
        L.BeginModule("DG");
        L.BeginModule("Tweening");
        DG_Tweening_DOTweenWrap.Register(L);
        DG_Tweening_TweenWrap.Register(L);
        DG_Tweening_SequenceWrap.Register(L);
        DG_Tweening_TweenerWrap.Register(L);
        DG_Tweening_LoopTypeWrap.Register(L);
        DG_Tweening_PathModeWrap.Register(L);
        DG_Tweening_PathTypeWrap.Register(L);
        L.BeginModule("Core");
        L.RegFunction("DOGetter_float", DG_Tweening_Core_DOGetter_float);
        L.RegFunction("DOSetter_float", DG_Tweening_Core_DOSetter_float);
        L.RegFunction("DOGetter_double", DG_Tweening_Core_DOGetter_double);
        L.RegFunction("DOSetter_double", DG_Tweening_Core_DOSetter_double);
        L.RegFunction("DOGetter_int", DG_Tweening_Core_DOGetter_int);
        L.RegFunction("DOSetter_int", DG_Tweening_Core_DOSetter_int);
        L.RegFunction("DOGetter_uint", DG_Tweening_Core_DOGetter_uint);
        L.RegFunction("DOSetter_uint", DG_Tweening_Core_DOSetter_uint);
        L.RegFunction("DOGetter_long", DG_Tweening_Core_DOGetter_long);
        L.RegFunction("DOSetter_long", DG_Tweening_Core_DOSetter_long);
        L.RegFunction("DOGetter_ulong", DG_Tweening_Core_DOGetter_ulong);
        L.RegFunction("DOSetter_ulong", DG_Tweening_Core_DOSetter_ulong);
        L.RegFunction("DOGetter_string", DG_Tweening_Core_DOGetter_string);
        L.RegFunction("DOSetter_string", DG_Tweening_Core_DOSetter_string);
        L.RegFunction("DOGetter_UnityEngine_Vector2", DG_Tweening_Core_DOGetter_UnityEngine_Vector2);
        L.RegFunction("DOSetter_UnityEngine_Vector2", DG_Tweening_Core_DOSetter_UnityEngine_Vector2);
        L.RegFunction("DOGetter_UnityEngine_Vector3", DG_Tweening_Core_DOGetter_UnityEngine_Vector3);
        L.RegFunction("DOSetter_UnityEngine_Vector3", DG_Tweening_Core_DOSetter_UnityEngine_Vector3);
        L.RegFunction("DOGetter_UnityEngine_Vector4", DG_Tweening_Core_DOGetter_UnityEngine_Vector4);
        L.RegFunction("DOSetter_UnityEngine_Vector4", DG_Tweening_Core_DOSetter_UnityEngine_Vector4);
        L.RegFunction("DOGetter_UnityEngine_Quaternion", DG_Tweening_Core_DOGetter_UnityEngine_Quaternion);
        L.RegFunction("DOSetter_UnityEngine_Quaternion", DG_Tweening_Core_DOSetter_UnityEngine_Quaternion);
        L.RegFunction("DOGetter_UnityEngine_Color", DG_Tweening_Core_DOGetter_UnityEngine_Color);
        L.RegFunction("DOSetter_UnityEngine_Color", DG_Tweening_Core_DOSetter_UnityEngine_Color);
        L.RegFunction("DOGetter_UnityEngine_Rect", DG_Tweening_Core_DOGetter_UnityEngine_Rect);
        L.RegFunction("DOSetter_UnityEngine_Rect", DG_Tweening_Core_DOSetter_UnityEngine_Rect);
        L.RegFunction("DOGetter_UnityEngine_RectOffset", DG_Tweening_Core_DOGetter_UnityEngine_RectOffset);
        L.RegFunction("DOSetter_UnityEngine_RectOffset", DG_Tweening_Core_DOSetter_UnityEngine_RectOffset);
        L.EndModule();
        L.EndModule();
        L.EndModule();
        L.BeginModule("UnityEngine");
        UnityEngine_ComponentWrap.Register(L);
        UnityEngine_TransformWrap.Register(L);
        UnityEngine_LightWrap.Register(L);
        UnityEngine_MaterialWrap.Register(L);
        UnityEngine_RigidbodyWrap.Register(L);
        UnityEngine_CameraWrap.Register(L);
        UnityEngine_AudioSourceWrap.Register(L);
        UnityEngine_LineRendererWrap.Register(L);
        UnityEngine_TrailRendererWrap.Register(L);
        UnityEngine_BehaviourWrap.Register(L);
        UnityEngine_MonoBehaviourWrap.Register(L);
        UnityEngine_GameObjectWrap.Register(L);
        UnityEngine_TrackedReferenceWrap.Register(L);
        UnityEngine_ApplicationWrap.Register(L);
        UnityEngine_PhysicsWrap.Register(L);
        UnityEngine_ColliderWrap.Register(L);
        UnityEngine_TimeWrap.Register(L);
        UnityEngine_TextureWrap.Register(L);
        UnityEngine_Texture2DWrap.Register(L);
        UnityEngine_ShaderWrap.Register(L);
        UnityEngine_RendererWrap.Register(L);
        UnityEngine_WWWWrap.Register(L);
        UnityEngine_ScreenWrap.Register(L);
        UnityEngine_CameraClearFlagsWrap.Register(L);
        UnityEngine_AudioClipWrap.Register(L);
        UnityEngine_AssetBundleWrap.Register(L);
        UnityEngine_ParticleSystemWrap.Register(L);
        UnityEngine_AsyncOperationWrap.Register(L);
        UnityEngine_LightTypeWrap.Register(L);
        UnityEngine_SleepTimeoutWrap.Register(L);
        UnityEngine_AnimatorWrap.Register(L);
        UnityEngine_InputWrap.Register(L);
        UnityEngine_KeyCodeWrap.Register(L);
        UnityEngine_SkinnedMeshRendererWrap.Register(L);
        UnityEngine_SpaceWrap.Register(L);
        UnityEngine_MeshRendererWrap.Register(L);
        UnityEngine_ParticleEmitterWrap.Register(L);
        UnityEngine_ParticleRendererWrap.Register(L);
        UnityEngine_ParticleAnimatorWrap.Register(L);
        UnityEngine_BoxColliderWrap.Register(L);
        UnityEngine_MeshColliderWrap.Register(L);
        UnityEngine_SphereColliderWrap.Register(L);
        UnityEngine_CharacterControllerWrap.Register(L);
        UnityEngine_CapsuleColliderWrap.Register(L);
        UnityEngine_AnimationWrap.Register(L);
        UnityEngine_AnimationClipWrap.Register(L);
        UnityEngine_AnimationStateWrap.Register(L);
        UnityEngine_AnimationBlendModeWrap.Register(L);
        UnityEngine_QueueModeWrap.Register(L);
        UnityEngine_PlayModeWrap.Register(L);
        UnityEngine_WrapModeWrap.Register(L);
        UnityEngine_QualitySettingsWrap.Register(L);
        UnityEngine_RenderSettingsWrap.Register(L);
        UnityEngine_BlendWeightsWrap.Register(L);
        UnityEngine_RenderTextureWrap.Register(L);
        UnityEngine_SpriteWrap.Register(L);
        UnityEngine_RectWrap.Register(L);
        UnityEngine_RectTransformWrap.Register(L);
        UnityEngine_RectTransformUtilityWrap.Register(L);
        UnityEngine_CanvasWrap.Register(L);
        L.BeginModule("Experimental");
        L.BeginModule("Director");
        UnityEngine_Experimental_Director_DirectorPlayerWrap.Register(L);
        L.EndModule();
        L.EndModule();
        L.BeginModule("UI");
        UnityEngine_UI_GraphicWrap.Register(L);
        UnityEngine_UI_MaskableGraphicWrap.Register(L);
        UnityEngine_UI_ImageWrap.Register(L);
        UnityEngine_UI_TextWrap.Register(L);
        UnityEngine_UI_ToggleWrap.Register(L);
        UnityEngine_UI_ToggleGroupWrap.Register(L);
        UnityEngine_UI_InputFieldWrap.Register(L);
        UnityEngine_UI_LayoutGroupWrap.Register(L);
        UnityEngine_UI_HorizontalOrVerticalLayoutGroupWrap.Register(L);
        UnityEngine_UI_VerticalLayoutGroupWrap.Register(L);
        UnityEngine_UI_HorizontalLayoutGroupWrap.Register(L);
        UnityEngine_UI_ContentSizeFitterWrap.Register(L);
        UnityEngine_UI_DropdownWrap.Register(L);
        UnityEngine_UI_MaskWrap.Register(L);
        UnityEngine_UI_RectMask2DWrap.Register(L);
        UnityEngine_UI_LayoutElementWrap.Register(L);
        UnityEngine_UI_SliderWrap.Register(L);
        UnityEngine_UI_ScrollbarWrap.Register(L);
        UnityEngine_UI_SelectableWrap.Register(L);
        UnityEngine_UI_ButtonWrap.Register(L);
        UnityEngine_UI_GraphicRaycasterWrap.Register(L);
        UnityEngine_UI_ScrollRectWrap.Register(L);
        UnityEngine_UI_LoopScrollRectWrap.Register(L);
        UnityEngine_UI_LoopVerticalScrollRectWrap.Register(L);
        UnityEngine_UI_LoopHorizontalScrollRectWrap.Register(L);
        L.EndModule();
        L.BeginModule("EventSystems");
        UnityEngine_EventSystems_UIBehaviourWrap.Register(L);
        UnityEngine_EventSystems_BaseRaycasterWrap.Register(L);
        L.EndModule();
        L.BeginModule("Events");
        L.RegFunction("UnityAction", UnityEngine_Events_UnityAction);
        L.EndModule();
        L.EndModule();
        L.BeginModule("System");
        L.RegFunction("Action", System_Action);
        L.RegFunction("Action_float", System_Action_float);
        L.RegFunction("Action_float_float", System_Action_float_float);
        L.RegFunction("Action_float_object", System_Action_float_object);
        L.RegFunction("Action_UnityEngine_Vector2", System_Action_UnityEngine_Vector2);
        L.RegFunction("Action_UnityEngine_Vector3", System_Action_UnityEngine_Vector3);
        L.RegFunction("Action_UnityEngine_Vector3_object", System_Action_UnityEngine_Vector3_object);
        L.RegFunction("Action_UnityEngine_Color", System_Action_UnityEngine_Color);
        L.RegFunction("Action_object", System_Action_object);
        L.RegFunction("Action_LTEvent", System_Action_LTEvent);
        L.EndModule();
        L.EndModule();
        Debugger.Log("Register lua type cost time: {0}", Time.realtimeSinceStartup - t);
    }
Пример #4
0
        private void InteractionFrameReady(object sender, InteractionFrameReadyEventArgs e)
        {
            // Check for a null userInfos since we may still get posted events
            // from the stream after we have unregistered our event handler and
            // deleted our buffers.
            if (this.userInfos == null)
            {
                return;
            }

            if (this.kinectAdapter.IsInInteractionFrame)
            {
                Debugger.Log(
                    0,
                    "warning",
                    "Application might have raised modal UI (e.g.: message box) while handling KinectRegion event. Applications are advised to raise modal UI via a call to System.Windows.Threading.Dispatcher.BeginInvoke instead.\n");
                return;
            }

            UserInfo[] localUserInfos = null;
            long       timestamp      = 0;

            using (InteractionFrame interactionFrame = e.OpenInteractionFrame())
            {
                if (interactionFrame != null)
                {
                    // Copy interaction frame data so we can dispose interaction frame
                    // right away, even if data processing/event handling takes a while.
                    interactionFrame.CopyInteractionDataTo(this.userInfos);
                    timestamp      = interactionFrame.Timestamp;
                    localUserInfos = this.userInfos;
                }
            }

            if (localUserInfos != null)
            {
                this.kinectAdapter.BeginInteractionFrame();

                try
                {
                    bool wasProcessingAborted = false;

                    // Distribute routed events based on the state of all hand pointers
                    for (int userIndex = 0; userIndex < localUserInfos.Length; ++userIndex)
                    {
                        var user = localUserInfos[userIndex];
                        foreach (var handPointer in user.HandPointers)
                        {
                            this.HandleHandPointerData(timestamp, user, userIndex, handPointer);

                            if (localUserInfos != this.userInfos)
                            {
                                // Double-check that user info data being processed is still valid.
                                // Client might have invalidated it by changing the KinectSensor
                                // while handling a KinectRegion event.
                                wasProcessingAborted = true;
                                break;
                            }
                        }
                    }

                    if (wasProcessingAborted)
                    {
                        Debugger.Log(
                            0,
                            "warning",
                            "Application might have changed KinectSensor while handling KinectRegion event. Applications are advised to change KinectSensor via a call to System.Windows.Threading.Dispatcher.BeginInvoke instead.\n");
                    }
                    else
                    {
                        this.PrimaryUserTrackingId = this.kinectAdapter.ChoosePrimaryUser(timestamp, this.PrimaryUserTrackingId, this.QueryPrimaryUserTrackingIdCallback);
                    }
                }
                finally
                {
                    this.kinectAdapter.EndInteractionFrame();
                }
            }
        }
Пример #5
0
        //void Update() {
        //    if (tno.isMine) {
        //        refTime += Time.deltaTime;
        //        if (refTime >= syncInterval) {
        //            refTime = 0;
        //            tno.Send("SyncMove", Target.OthersSaved, name, rect.anchoredPosition, rigidbody.velocity, timestamp, false);
        //        }
        //    } else {
        //        var clientPing = ((float)TNManager.ping / 100) + pingMargin;
        //        var interpolationTime = timestamp - clientPing;
        //        if (serverStateBuffer[0] == null) {
        //            serverStateBuffer[0] = new NetState(0, rect.anchoredPosition, Quaternion.identity);
        //        }
        //        //Try interpolation if possible.
        //        //If the latest serverStateBuffer timestamp is smaller than the latencytime))
        //        //we're not slow enough to really lag out and just extrapolate.
        //        //尝试插值如果可能的话。
        //        //如果最近serverStateBuffer时间戳小于延迟时间
        //        //我们不是足够缓慢滞后,只是推断。
        //        if (serverStateBuffer[0].timestamp > interpolationTime) {
        //            for (int i = 0; i < serverStateBuffer.Length; i++) {
        //                if (serverStateBuffer[i] == null) {
        //                    continue;
        //                }
        //                // Find the state which matches the interp. time or use last state
        //                // 找到匹配插值函数的状态。时间或使用最后的状态
        //                if (serverStateBuffer[i].timestamp <= interpolationTime || i == serverStateBuffer.Length - 1) {
        //                    // The state one frame newer than the best playback state
        //                    // 这一帧更新比最好的重放状态
        //                    var bestTarget = serverStateBuffer[Mathf.Max(i - 1, 0)];

        //                    // The best playback state (closest current network time))
        //                    // 最好的重放状态(接近当前的网络时间))
        //                    var bestStart = serverStateBuffer[i];
        //                    var timediff = bestTarget.timestamp - bestStart.timestamp;
        //                    var lerpTime = 0.0F;

        //                    // Increase the interpolation amount by growing ping
        //                    // Reverse that for more smooth but less accurate positioning
        //                    // 插值数量增加越来越平逆转,光滑但不精确定位
        //                    if (timediff > 0.0001) {
        //                        lerpTime = ((interpolationTime - bestStart.timestamp) / timediff);
        //                    }
        //                    var newPos = Vector2.Lerp(bestStart.pos, bestTarget.pos, lerpTime);
        //                    FixedPos(ref newPos);
        //                    rect.anchoredPosition = newPos;
        //                    //found our way through to lerp the positions, lets return here
        //                    //发现在插值的位置,我们的方法可以这里返回
        //                    return;
        //                }
        //            }
        //        } else {
        //            var latest = serverStateBuffer[0];
        //            var distance = Vector2.Distance(rect.anchoredPosition, latest.pos);
        //            if (distance >= positionErrorThreshold) {
        //                var lerp = ((1 / distance) * 250f) / 100f;
        //                var newPos = Vector2.Lerp(rect.anchoredPosition, latest.pos, lerp);
        //                FixedPos(ref newPos);
        //                rect.anchoredPosition = newPos;
        //            }
        //        }
        //    }
        //}

        void OnJoystickStart(Vector2 vec)
        {
            Debugger.Log("OnJoystickStart-->>" + vec);
        }
Пример #6
0
    void OnGUI()
    {
        GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 150, 800, 400), tips);

        if (GUI.Button(new Rect(10, 10, 120, 40), "Error1"))
        {
            tips = "";
            showStack.BeginPCall();
            showStack.Push(go);
            showStack.PCall();
            showStack.EndPCall();
            showStack.Dispose();
            showStack = null;
        }
        else if (GUI.Button(new Rect(10, 60, 120, 40), "Instantiate Error"))
        {
            tips = "";
            LuaFunction func = state.GetFunction("Instantiate");
            func.BeginPCall();
            func.Push(go);
            func.PCall();
            func.EndPCall();
            func.Dispose();
        }
        else if (GUI.Button(new Rect(10, 110, 120, 40), "Check Error"))
        {
            tips = "";
            LuaFunction func = state.GetFunction("TestRay");
            func.BeginPCall();
            func.PCall();
            func.CheckRay();        //返回值出错
            func.EndPCall();
            func.Dispose();
        }
        else if (GUI.Button(new Rect(10, 160, 120, 40), "Push Error"))
        {
            tips = "";
            LuaFunction func = state.GetFunction("TestRay");
            func.BeginPCall();
            func.Push(Instance);
            func.PCall();
            func.EndPCall();
            func.Dispose();
        }
        else if (GUI.Button(new Rect(10, 210, 120, 40), "LuaPushError"))
        {
            //需要改lua文件让其出错
            tips = "";
            LuaFunction func = state.GetFunction("PushLuaError");
            func.BeginPCall();
            func.PCall();
            func.EndPCall();
            func.Dispose();
        }
        else if (GUI.Button(new Rect(10, 260, 120, 40), "Check Error"))
        {
            tips = "";
            LuaFunction func = state.GetFunction("Test5");
            func.BeginPCall();
            func.PCall();
            func.EndPCall();
            func.Dispose();
        }
        else if (GUI.Button(new Rect(10, 310, 120, 40), "Test Resume"))
        {
            tips = "";
            LuaFunction func = state.GetFunction("Test6");
            func.BeginPCall();
            func.PCall();
            func.EndPCall();
            func.Dispose();
        }
        else if (GUI.Button(new Rect(10, 360, 120, 40), "out of bound"))
        {
            tips = "";
            LuaFunction func = state.GetFunction("TestOutOfBound");
            func.BeginPCall();
            func.PCall();
            func.EndPCall();
            func.Dispose();
        }
        else if (GUI.Button(new Rect(10, 410, 120, 40), "TestArgError"))
        {
            tips = "";
            LuaFunction func = state.GetFunction("Test8");
            func.BeginPCall();
            func.PCall();
            func.EndPCall();
            func.Dispose();
        }
        else if (GUI.Button(new Rect(10, 460, 120, 40), "TestFuncDispose"))
        {
            tips = "";
            LuaFunction func = state.GetFunction("Test8");
            func.Dispose();
            func.BeginPCall();
            func.PCall();
            func.EndPCall();
            func.Dispose();
        }
        else if (GUI.Button(new Rect(10, 510, 120, 40), "SendMessage"))
        {
            tips = "";
            gameObject.SendMessage("OnSendMsg");
        }
        else if (GUI.Button(new Rect(10, 560, 120, 40), "SendMessageInLua"))
        {
            LuaFunction func = state.GetFunction("SendMsgError");
            func.BeginPCall();
            func.Push(gameObject);
            func.PCall();
            func.EndPCall();
            func.Dispose();
        }
        else if (GUI.Button(new Rect(10, 610, 120, 40), "AddComponent"))
        {
            tips = "";
            LuaFunction func = state.GetFunction("TestAddComponent");
            func.BeginPCall();
            func.Push(gameObject);
            func.PCall();
            func.EndPCall();
            func.Dispose();
        }
        else if (GUI.Button(new Rect(210, 10, 120, 40), "TableGetSet"))
        {
            tips = "";
            LuaTable table = state.GetTable("testev");
            int      top   = state.LuaGetTop();

            try
            {
                state.Push(table);
                state.LuaGetField(-1, "Add");
                LuaFunction func = state.CheckLuaFunction(-1);

                if (func != null)
                {
                    func.Call();
                    func.Dispose();
                }

                state.LuaPop(1);
                state.Push(123456);
                state.LuaSetField(-2, "value");
                state.LuaGetField(-1, "value");
                int n = (int)state.CheckNumber(-1);
                Debugger.Log("value is: " + n);

                state.LuaPop(1);

                state.Push("Add");
                state.LuaGetTable(-2);

                func = state.CheckLuaFunction(-1);

                if (func != null)
                {
                    func.Call();
                    func.Dispose();
                }

                state.LuaPop(1);

                state.Push("look");
                state.Push(456789);
                state.LuaSetTable(-3);

                state.LuaGetField(-1, "look");
                n = (int)state.CheckNumber(-1);
                Debugger.Log("look: " + n);
            }
            catch (Exception e)
            {
                state.LuaSetTop(top);
                throw e;
            }

            state.LuaSetTop(top);
        }
        else if (GUI.Button(new Rect(210, 60, 120, 40), "TestTableInCo"))
        {
            tips = "";
            LuaFunction func = state.GetFunction("TestCoTable");
            func.BeginPCall();
            func.PCall();
            func.EndPCall();
            func.Dispose();
        }
        else if (GUI.Button(new Rect(210, 110, 120, 40), "Instantiate2 Error"))
        {
            tips = "";
            LuaFunction func = state.GetFunction("Instantiate");
            func.BeginPCall();
            func.Push(go2);
            func.PCall();
            func.EndPCall();
            func.Dispose();
        }
        else if (GUI.Button(new Rect(210, 160, 120, 40), "Instantiate3 Error"))
        {
            tips = "";
            UnityEngine.Object.Instantiate(go2);
        }
        else if (GUI.Button(new Rect(210, 210, 120, 40), "TestCycle"))
        {
            tips = "";
            int         n    = 20;
            LuaFunction func = state.GetFunction("TestCycle");
            func.BeginPCall();
            func.Push(n);
            func.PCall();
            int c = (int)func.CheckNumber();
            func.EndPCall();

            Debugger.Log("Fib({0}) is {1}", n, c);
        }
        else if (GUI.Button(new Rect(210, 260, 120, 40), "TestNull"))
        {
            tips = "";
            Action action = () =>
            {
                LuaFunction func = state.GetFunction("TestNull");
                func.BeginPCall();
                func.PushObject(null);
                func.PCall();
                func.EndPCall();
            };

            StartCoroutine(TestCo(action));
        }
        else if (GUI.Button(new Rect(210, 310, 120, 40), "TestMulti"))
        {
            tips = "";
            LuaFunction func = state.GetFunction("TestMulStack");
            func.BeginPCall();
            func.PushObject(null);
            func.PCall();
            func.EndPCall();
        }
    }
Пример #7
0
 void TestD1()
 {
     Debugger.Log("delegate 1");
     TestDelegate -= TestD2;
 }
Пример #8
0
    public static void Bind(LuaState L)
    {
        float t = Time.realtimeSinceStartup;

        L.BeginModule(null);
        TweenUtilsWrap.Register(L);
        EffectRenderObjManagerWrap.Register(L);
        EffectRenderObjWrap.Register(L);
        EffectControllerWrap.Register(L);
        NodeWrap.Register(L);
        GlobalDispatcherWrap.Register(L);
        LayerTagWrap.Register(L);
        LayersMgrWrap.Register(L);
        GSpriteWrap.Register(L);
        UBBParserExtensionWrap.Register(L);
        BaseWindowWrap.Register(L);
        CameraControllerWrap.Register(L);
        LuaBindSceneObjWrap.Register(L);
        CanYingWrap.Register(L);
        DrawUtilsWrap.Register(L);
        EndianWrap.Register(L);
        NormalCameraControllerWrap.Register(L);
        MicroPhoneInputWrap.Register(L);
        PayMgrWrap.Register(L);
        SdkToIOSWrap.Register(L);
        DeviceInfoWrap.Register(L);
        SceneObjTriggerWrap.Register(L);
        ViewWrap.Register(L);
        BaseWrap.Register(L);
        ManagerWrap.Register(L);
        MonoSingleton_LuaFramework_NetworkManagerWrap.Register(L);
        MonoSingleton_LayersMgrWrap.Register(L);
        MonoSingleton_PayMgrWrap.Register(L);
        MonoSingleton_SdkToIOSWrap.Register(L);
        L.BeginModule("UnityEngine");
        UnityEngine_ComponentWrap.Register(L);
        UnityEngine_TransformWrap.Register(L);
        UnityEngine_MaterialWrap.Register(L);
        UnityEngine_LightWrap.Register(L);
        UnityEngine_CameraWrap.Register(L);
        UnityEngine_AudioSourceWrap.Register(L);
        UnityEngine_BehaviourWrap.Register(L);
        UnityEngine_MonoBehaviourWrap.Register(L);
        UnityEngine_GameObjectWrap.Register(L);
        UnityEngine_TrackedReferenceWrap.Register(L);
        UnityEngine_ApplicationWrap.Register(L);
        UnityEngine_PhysicsWrap.Register(L);
        UnityEngine_ColliderWrap.Register(L);
        UnityEngine_TimeWrap.Register(L);
        UnityEngine_TextureWrap.Register(L);
        UnityEngine_Texture2DWrap.Register(L);
        UnityEngine_ShaderWrap.Register(L);
        UnityEngine_RendererWrap.Register(L);
        UnityEngine_WWWWrap.Register(L);
        UnityEngine_ScreenWrap.Register(L);
        UnityEngine_CameraClearFlagsWrap.Register(L);
        UnityEngine_AudioClipWrap.Register(L);
        UnityEngine_AssetBundleWrap.Register(L);
        UnityEngine_ParticleSystemWrap.Register(L);
        UnityEngine_AsyncOperationWrap.Register(L);
        UnityEngine_LightTypeWrap.Register(L);
        UnityEngine_SleepTimeoutWrap.Register(L);
        UnityEngine_AnimatorWrap.Register(L);
        UnityEngine_InputWrap.Register(L);
        UnityEngine_KeyCodeWrap.Register(L);
        UnityEngine_SkinnedMeshRendererWrap.Register(L);
        UnityEngine_SpaceWrap.Register(L);
        UnityEngine_AnimationBlendModeWrap.Register(L);
        UnityEngine_QueueModeWrap.Register(L);
        UnityEngine_PlayModeWrap.Register(L);
        UnityEngine_WrapModeWrap.Register(L);
        UnityEngine_QualitySettingsWrap.Register(L);
        UnityEngine_RenderSettingsWrap.Register(L);
        UnityEngine_ResourcesWrap.Register(L);
        UnityEngine_RectTransformWrap.Register(L);
        UnityEngine_Matrix4x4Wrap.Register(L);
        UnityEngine_PlayerPrefsWrap.Register(L);
        UnityEngine_ControllerColliderHitWrap.Register(L);
        UnityEngine_AnimatorStateInfoWrap.Register(L);
        UnityEngine_NavMeshPathStatusWrap.Register(L);
        UnityEngine_NavMeshAgentWrap.Register(L);
        L.BeginModule("Experimental");
        L.BeginModule("Director");
        UnityEngine_Experimental_Director_DirectorPlayerWrap.Register(L);
        L.EndModule();
        L.EndModule();
        L.BeginModule("SceneManagement");
        UnityEngine_SceneManagement_LoadSceneModeWrap.Register(L);
        UnityEngine_SceneManagement_SceneManagerWrap.Register(L);
        UnityEngine_SceneManagement_SceneWrap.Register(L);
        L.EndModule();
        L.BeginModule("UI");
        UnityEngine_UI_TextWrap.Register(L);
        UnityEngine_UI_RawImageWrap.Register(L);
        UnityEngine_UI_MaskableGraphicWrap.Register(L);
        UnityEngine_UI_GraphicWrap.Register(L);
        L.EndModule();
        L.BeginModule("EventSystems");
        UnityEngine_EventSystems_UIBehaviourWrap.Register(L);
        L.EndModule();
        L.BeginModule("Events");
        L.RegFunction("UnityAction", UnityEngine_Events_UnityAction);
        L.EndModule();
        L.BeginModule("Camera");
        L.RegFunction("CameraCallback", UnityEngine_Camera_CameraCallback);
        L.EndModule();
        L.BeginModule("Application");
        L.RegFunction("LogCallback", UnityEngine_Application_LogCallback);
        L.RegFunction("AdvertisingIdentifierCallback", UnityEngine_Application_AdvertisingIdentifierCallback);
        L.EndModule();
        L.BeginModule("AudioClip");
        L.RegFunction("PCMReaderCallback", UnityEngine_AudioClip_PCMReaderCallback);
        L.RegFunction("PCMSetPositionCallback", UnityEngine_AudioClip_PCMSetPositionCallback);
        L.EndModule();
        L.BeginModule("RectTransform");
        L.RegFunction("ReapplyDrivenProperties", UnityEngine_RectTransform_ReapplyDrivenProperties);
        L.EndModule();
        L.EndModule();
        L.BeginModule("LuaFramework");
        LuaFramework_UtilWrap.Register(L);
        LuaFramework_AppConstWrap.Register(L);
        LuaFramework_LuaHelperWrap.Register(L);
        LuaFramework_ByteBufferWrap.Register(L);
        LuaFramework_LuaBehaviourWrap.Register(L);
        LuaFramework_GameManagerWrap.Register(L);
        LuaFramework_LuaManagerWrap.Register(L);
        LuaFramework_LoaderManagerWrap.Register(L);
        LuaFramework_SoundManagerWrap.Register(L);
        LuaFramework_TimerManagerWrap.Register(L);
        LuaFramework_NetworkManagerWrap.Register(L);
        LuaFramework_ResourceManagerWrap.Register(L);
        L.EndModule();
        L.BeginModule("FairyGUI");
        FairyGUI_EventContextWrap.Register(L);
        FairyGUI_EventDispatcherWrap.Register(L);
        FairyGUI_EventListenerWrap.Register(L);
        FairyGUI_InputEventWrap.Register(L);
        FairyGUI_DisplayObjectWrap.Register(L);
        FairyGUI_ContainerWrap.Register(L);
        FairyGUI_StageWrap.Register(L);
        FairyGUI_ControllerWrap.Register(L);
        FairyGUI_GObjectWrap.Register(L);
        FairyGUI_GGraphWrap.Register(L);
        FairyGUI_GGroupWrap.Register(L);
        FairyGUI_GImageWrap.Register(L);
        FairyGUI_GLoaderWrap.Register(L);
        FairyGUI_PlayStateWrap.Register(L);
        FairyGUI_GMovieClipWrap.Register(L);
        FairyGUI_TextFormatWrap.Register(L);
        FairyGUI_GTextFieldWrap.Register(L);
        FairyGUI_GRichTextFieldWrap.Register(L);
        FairyGUI_GTextInputWrap.Register(L);
        FairyGUI_GComponentWrap.Register(L);
        FairyGUI_GListWrap.Register(L);
        FairyGUI_GRootWrap.Register(L);
        FairyGUI_GLabelWrap.Register(L);
        FairyGUI_GButtonWrap.Register(L);
        FairyGUI_GComboBoxWrap.Register(L);
        FairyGUI_GProgressBarWrap.Register(L);
        FairyGUI_GSliderWrap.Register(L);
        FairyGUI_PopupMenuWrap.Register(L);
        FairyGUI_ScrollPaneWrap.Register(L);
        FairyGUI_TransitionWrap.Register(L);
        FairyGUI_UIPackageWrap.Register(L);
        FairyGUI_WindowWrap.Register(L);
        FairyGUI_GObjectPoolWrap.Register(L);
        FairyGUI_RelationsWrap.Register(L);
        FairyGUI_RelationTypeWrap.Register(L);
        FairyGUI_TimersWrap.Register(L);
        FairyGUI_LuaUIHelperWrap.Register(L);
        FairyGUI_GLuaComponentWrap.Register(L);
        FairyGUI_GLuaLabelWrap.Register(L);
        FairyGUI_GLuaButtonWrap.Register(L);
        FairyGUI_GLuaProgressBarWrap.Register(L);
        FairyGUI_GLuaSliderWrap.Register(L);
        FairyGUI_GLuaComboBoxWrap.Register(L);
        FairyGUI_LuaWindowWrap.Register(L);
        FairyGUI_GoWrapperWrap.Register(L);
        FairyGUI_TreeViewWrap.Register(L);
        FairyGUI_TreeNodeWrap.Register(L);
        FairyGUI_PageOptionWrap.Register(L);
        FairyGUI_UIPanelWrap.Register(L);
        FairyGUI_UIPainterWrap.Register(L);
        FairyGUI_UIObjectFactoryWrap.Register(L);
        FairyGUI_UIContentScalerWrap.Register(L);
        FairyGUI_MarginWrap.Register(L);
        FairyGUI_NTextureWrap.Register(L);
        FairyGUI_UIConfigWrap.Register(L);
        FairyGUI_AutoSizeTypeWrap.Register(L);
        FairyGUI_ScrollTypeWrap.Register(L);
        FairyGUI_AlignTypeWrap.Register(L);
        FairyGUI_VertAlignTypeWrap.Register(L);
        FairyGUI_OverflowTypeWrap.Register(L);
        FairyGUI_FillTypeWrap.Register(L);
        FairyGUI_ListLayoutTypeWrap.Register(L);
        L.RegFunction("EventCallback0", FairyGUI_EventCallback0);
        L.RegFunction("EventCallback1", FairyGUI_EventCallback1);
        L.RegFunction("PlayCompleteCallback", FairyGUI_PlayCompleteCallback);
        L.RegFunction("TransitionHook", FairyGUI_TransitionHook);
        L.RegFunction("ListItemRenderer", FairyGUI_ListItemRenderer);
        L.RegFunction("ListItemProvider", FairyGUI_ListItemProvider);
        L.RegFunction("TimerCallback", FairyGUI_TimerCallback);
        L.BeginModule("Utils");
        FairyGUI_Utils_UBBParserWrap.Register(L);
        L.EndModule();
        L.BeginModule("UIPackage");
        L.RegFunction("LoadResource", FairyGUI_UIPackage_LoadResource);
        L.RegFunction("CreateObjectCallback", FairyGUI_UIPackage_CreateObjectCallback);
        L.EndModule();
        L.BeginModule("GObjectPool");
        L.RegFunction("InitCallbackDelegate", FairyGUI_GObjectPool_InitCallbackDelegate);
        L.EndModule();
        L.BeginModule("TreeView");
        L.RegFunction("TreeNodeCreateCellDelegate", FairyGUI_TreeView_TreeNodeCreateCellDelegate);
        L.RegFunction("TreeNodeRenderDelegate", FairyGUI_TreeView_TreeNodeRenderDelegate);
        L.RegFunction("TreeNodeWillExpandDelegate", FairyGUI_TreeView_TreeNodeWillExpandDelegate);
        L.EndModule();
        L.EndModule();
        L.BeginModule("DG");
        L.BeginModule("Tweening");
        DG_Tweening_SequenceWrap.Register(L);
        DG_Tweening_EaseWrap.Register(L);
        DG_Tweening_TweenWrap.Register(L);
        L.BeginModule("Core");
        DG_Tweening_Core_ABSSequentiableWrap.Register(L);
        L.EndModule();
        L.EndModule();
        L.EndModule();
        L.BeginModule("System");
        L.RegFunction("Action", System_Action);
        L.RegFunction("Predicate_int", System_Predicate_int);
        L.RegFunction("Action_int", System_Action_int);
        L.RegFunction("Comparison_int", System_Comparison_int);
        L.RegFunction("Action_string", System_Action_string);
        L.RegFunction("Action_float", System_Action_float);
        L.RegFunction("Action_UnityEngine_Object", System_Action_UnityEngine_Object);
        L.BeginModule("Collections");
        System_Collections_QueueWrap.Register(L);
        L.EndModule();
        L.EndModule();
        L.BeginModule("EffectRenderObj");
        L.RegFunction("LoadComCallBack", EffectRenderObj_LoadComCallBack);
        L.EndModule();
        L.EndModule();
        L.BeginPreLoad();
        L.AddPreLoad("UnityEngine.MeshRenderer", LuaOpen_UnityEngine_MeshRenderer, typeof(UnityEngine.MeshRenderer));
        L.AddPreLoad("UnityEngine.ParticleEmitter", LuaOpen_UnityEngine_ParticleEmitter, typeof(UnityEngine.ParticleEmitter));
        L.AddPreLoad("UnityEngine.ParticleRenderer", LuaOpen_UnityEngine_ParticleRenderer, typeof(UnityEngine.ParticleRenderer));
        L.AddPreLoad("UnityEngine.ParticleAnimator", LuaOpen_UnityEngine_ParticleAnimator, typeof(UnityEngine.ParticleAnimator));
        L.AddPreLoad("UnityEngine.BoxCollider", LuaOpen_UnityEngine_BoxCollider, typeof(UnityEngine.BoxCollider));
        L.AddPreLoad("UnityEngine.MeshCollider", LuaOpen_UnityEngine_MeshCollider, typeof(UnityEngine.MeshCollider));
        L.AddPreLoad("UnityEngine.SphereCollider", LuaOpen_UnityEngine_SphereCollider, typeof(UnityEngine.SphereCollider));
        L.AddPreLoad("UnityEngine.CharacterController", LuaOpen_UnityEngine_CharacterController, typeof(UnityEngine.CharacterController));
        L.AddPreLoad("UnityEngine.CapsuleCollider", LuaOpen_UnityEngine_CapsuleCollider, typeof(UnityEngine.CapsuleCollider));
        L.AddPreLoad("UnityEngine.Animation", LuaOpen_UnityEngine_Animation, typeof(UnityEngine.Animation));
        L.AddPreLoad("UnityEngine.AnimationClip", LuaOpen_UnityEngine_AnimationClip, typeof(UnityEngine.AnimationClip));
        L.AddPreLoad("UnityEngine.AnimationState", LuaOpen_UnityEngine_AnimationState, typeof(UnityEngine.AnimationState));
        L.AddPreLoad("UnityEngine.BlendWeights", LuaOpen_UnityEngine_BlendWeights, typeof(UnityEngine.BlendWeights));
        L.AddPreLoad("UnityEngine.RenderTexture", LuaOpen_UnityEngine_RenderTexture, typeof(UnityEngine.RenderTexture));
        L.AddPreLoad("UnityEngine.Rigidbody", LuaOpen_UnityEngine_Rigidbody, typeof(UnityEngine.Rigidbody));
        L.EndPreLoad();
        Debugger.Log("Register lua type cost time: {0}", Time.realtimeSinceStartup - t);
    }
 public override void OnOpen(Intent intent)
 {
     base.OnOpen(intent);
     UpdateData();
     Debugger.Log("UIPlayerInfoPanel Open");
 }
 public override void OnInit()
 {
     base.OnInit();
     Debugger.Log("UIPlayerInfoPanel Init");
 }
Пример #11
0
    public static void Bind(LuaState L)
    {
        float t = Time.realtimeSinceStartup;

        L.BeginModule(null);
        LuaInterface_DebuggerWrap.Register(L);
        LogHelperWrap.Register(L);
        LogColorWrap.Register(L);
        LuaProfilerExtensionWrap.Register(L);
        L.BeginModule("UnityEngine");
        UnityEngine_ComponentWrap.Register(L);
        UnityEngine_TransformWrap.Register(L);
        UnityEngine_MaterialWrap.Register(L);
        UnityEngine_LightWrap.Register(L);
        UnityEngine_CameraWrap.Register(L);
        UnityEngine_AudioSourceWrap.Register(L);
        UnityEngine_BehaviourWrap.Register(L);
        UnityEngine_MonoBehaviourWrap.Register(L);
        UnityEngine_GameObjectWrap.Register(L);
        UnityEngine_TrackedReferenceWrap.Register(L);
        UnityEngine_ApplicationWrap.Register(L);
        UnityEngine_PhysicsWrap.Register(L);
        UnityEngine_ColliderWrap.Register(L);
        UnityEngine_TimeWrap.Register(L);
        UnityEngine_TextureWrap.Register(L);
        UnityEngine_Texture2DWrap.Register(L);
        UnityEngine_ShaderWrap.Register(L);
        UnityEngine_RendererWrap.Register(L);
        UnityEngine_WWWWrap.Register(L);
        UnityEngine_ScreenWrap.Register(L);
        UnityEngine_CameraClearFlagsWrap.Register(L);
        UnityEngine_AudioClipWrap.Register(L);
        UnityEngine_AssetBundleWrap.Register(L);
        UnityEngine_ParticleSystemWrap.Register(L);
        UnityEngine_AsyncOperationWrap.Register(L);
        UnityEngine_LightTypeWrap.Register(L);
        UnityEngine_SleepTimeoutWrap.Register(L);
        UnityEngine_AnimatorWrap.Register(L);
        UnityEngine_InputWrap.Register(L);
        UnityEngine_KeyCodeWrap.Register(L);
        UnityEngine_SkinnedMeshRendererWrap.Register(L);
        UnityEngine_SpaceWrap.Register(L);
        UnityEngine_AnimationBlendModeWrap.Register(L);
        UnityEngine_QueueModeWrap.Register(L);
        UnityEngine_PlayModeWrap.Register(L);
        UnityEngine_WrapModeWrap.Register(L);
        UnityEngine_QualitySettingsWrap.Register(L);
        UnityEngine_RenderSettingsWrap.Register(L);
        UnityEngine_ResourcesWrap.Register(L);
        UnityEngine_RectTransformWrap.Register(L);
        L.BeginModule("UI");
        UnityEngine_UI_TextWrap.Register(L);
        UnityEngine_UI_MaskableGraphicWrap.Register(L);
        UnityEngine_UI_GraphicWrap.Register(L);
        L.EndModule();
        L.BeginModule("EventSystems");
        UnityEngine_EventSystems_UIBehaviourWrap.Register(L);
        L.EndModule();
        L.BeginModule("Events");
        L.RegFunction("UnityAction", UnityEngine_Events_UnityAction);
        L.EndModule();
        L.BeginModule("Camera");
        L.RegFunction("CameraCallback", UnityEngine_Camera_CameraCallback);
        L.EndModule();
        L.BeginModule("Application");
        L.RegFunction("LowMemoryCallback", UnityEngine_Application_LowMemoryCallback);
        L.RegFunction("AdvertisingIdentifierCallback", UnityEngine_Application_AdvertisingIdentifierCallback);
        L.RegFunction("LogCallback", UnityEngine_Application_LogCallback);
        L.EndModule();
        L.BeginModule("AudioClip");
        L.RegFunction("PCMReaderCallback", UnityEngine_AudioClip_PCMReaderCallback);
        L.RegFunction("PCMSetPositionCallback", UnityEngine_AudioClip_PCMSetPositionCallback);
        L.EndModule();
        L.BeginModule("RectTransform");
        L.RegFunction("ReapplyDrivenProperties", UnityEngine_RectTransform_ReapplyDrivenProperties);
        L.EndModule();
        L.EndModule();
        L.BeginModule("Framework");
        Framework_LuaMgrWrap.Register(L);
        Framework_LuaUtilityWrap.Register(L);
        Framework_LuaControllerWrap.Register(L);
        Framework_LuaComponentWrap.Register(L);
        Framework_SceneMgrWrap.Register(L);
        Framework_ResourceMgrWrap.Register(L);
        Framework_LuaBufferWrap.Register(L);
        Framework_LuaNetHelperWrap.Register(L);
        Framework_LuaHelperWrap.Register(L);
        Framework_MonoSingleton_Framework_LuaMgrWrap.Register(L);
        Framework_Singleton_Framework_LuaUtilityWrap.Register(L);
        Framework_Singleton_Framework_SceneMgrWrap.Register(L);
        Framework_MonoSingleton_Framework_ResourceMgrWrap.Register(L);
        L.RegFunction("SceneLoadEventHandler", Framework_SceneLoadEventHandler);
        L.RegFunction("ManagerInitEventHandler", Framework_ManagerInitEventHandler);
        L.EndModule();
        L.BeginModule("System");
        L.RegFunction("Action", System_Action);
        L.RegFunction("Predicate_int", System_Predicate_int);
        L.RegFunction("Action_int", System_Action_int);
        L.RegFunction("Comparison_int", System_Comparison_int);
        L.RegFunction("Func_int_int", System_Func_int_int);
        L.RegFunction("Action_UnityEngine_AsyncOperation", System_Action_UnityEngine_AsyncOperation);
        L.RegFunction("Action_float", System_Action_float);
        L.EndModule();
        L.EndModule();
        L.BeginPreLoad();
        L.AddPreLoad("UnityEngine.MeshRenderer", LuaOpen_UnityEngine_MeshRenderer, typeof(UnityEngine.MeshRenderer));
        L.AddPreLoad("UnityEngine.BoxCollider", LuaOpen_UnityEngine_BoxCollider, typeof(UnityEngine.BoxCollider));
        L.AddPreLoad("UnityEngine.MeshCollider", LuaOpen_UnityEngine_MeshCollider, typeof(UnityEngine.MeshCollider));
        L.AddPreLoad("UnityEngine.SphereCollider", LuaOpen_UnityEngine_SphereCollider, typeof(UnityEngine.SphereCollider));
        L.AddPreLoad("UnityEngine.CharacterController", LuaOpen_UnityEngine_CharacterController, typeof(UnityEngine.CharacterController));
        L.AddPreLoad("UnityEngine.CapsuleCollider", LuaOpen_UnityEngine_CapsuleCollider, typeof(UnityEngine.CapsuleCollider));
        L.AddPreLoad("UnityEngine.Animation", LuaOpen_UnityEngine_Animation, typeof(UnityEngine.Animation));
        L.AddPreLoad("UnityEngine.AnimationClip", LuaOpen_UnityEngine_AnimationClip, typeof(UnityEngine.AnimationClip));
        L.AddPreLoad("UnityEngine.AnimationState", LuaOpen_UnityEngine_AnimationState, typeof(UnityEngine.AnimationState));
        L.AddPreLoad("UnityEngine.BlendWeights", LuaOpen_UnityEngine_BlendWeights, typeof(UnityEngine.BlendWeights));
        L.AddPreLoad("UnityEngine.RenderTexture", LuaOpen_UnityEngine_RenderTexture, typeof(UnityEngine.RenderTexture));
        L.AddPreLoad("UnityEngine.Rigidbody", LuaOpen_UnityEngine_Rigidbody, typeof(UnityEngine.Rigidbody));
        L.EndPreLoad();
        Debugger.Log("Register lua type cost time: {0}", Time.realtimeSinceStartup - t);
    }
Пример #12
0
 public void FollowTarget(Transform target)
 {
     Debugger.Log("Camera start following!");
     FollowController.SetTarget(target);
 }
 // This method allows the user to quit the sample.
 private static void ExecuteBreak()
 {
     Console.WriteLine("Executing Debugger.Break.");
     Debugger.Break();
     Debugger.Log(1, "info", "test message");
 }
Пример #14
0
    private void InitWreckage(Transform parent, WreckageInfo info)
    {
        string     modelPath = info.ModelName;
        GameObject prefab    = AssetBundleLoader.Instance.GetAsset(AssetType.Model, modelPath) as GameObject;

        GameObject root = new GameObject();

        root.name = string.Format("wreckage_({0})_{1}", root.GetInstanceID(), info.Type);
        root.transform.SetParent(parent);
        root.transform.localPosition    = info.Position;
        root.transform.localEulerAngles = info.Face;

        GameObject instance = Utility.CommonInstantiate(prefab, root.transform);

        if (instance == null)
        {
            Debug.LogError("InitWreckage(), failed!");
            return;
        }
        Collider srcCollider = instance.GetComponent <Collider>();

        AttachCollider(root, srcCollider);
        Destroy(srcCollider);

        //不能着陆的区域碰撞检测
        Transform blockedTransRoot = instance.transform.FindChild(BLOCKED_ROOT_NAME);

        if (blockedTransRoot)
        {
            for (int i = 0; i < blockedTransRoot.childCount; i++)
            {
                Transform trans = blockedTransRoot.GetChild(i);
                trans.gameObject.AddComponent <WreckageBlock>();
            }
        }
        else
        {
            Debugger.LogErrorFormat("不能着陆的区域碰撞检测的根节点未找到, {0}", name);
        }

        BaseWreckage wreckage = AddScriptByWreckageType(info.Type, root);

        wreckage.StopPoint = InitStopPoint(root.transform, info);

        if (info.Nodetype == WreckageInfo.NodeType.Birth)
        {
            BirthWreckage = wreckage;
        }
        else if (info.Nodetype == WreckageInfo.NodeType.Escape)
        {
            wreckage.IsEscape = true;
            LevelGenerator.Instance.EscapeWreckageList.Add(wreckage);
            Debugger.Log("Is escape: " + root.name);
        }
        else
        {
        }

        List <Vector3> sourceGenPos = GetSourcePointList(info.SourcePointList, info.SourceInfoList.Length);

        Debugger.Assert(sourceGenPos.Count == info.SourceInfoList.Length, "资源点位置数量与资源点数量不一致!");
        List <BaseSource> sourcePosList = new List <BaseSource>();

        for (int i = 0; i < info.SourceInfoList.Length; i++)
        {
            BaseSource source = InitSourcePoints(root.transform, info.SourceInfoList[i], sourceGenPos[i]);
            sourcePosList.Add(source);
        }
        wreckage.SourcePointList = sourcePosList;
    }
Пример #15
0
 private static void Log(string fmt, params object[] args)
 {
     Debugger.Log(0, "", string.Format(fmt, args) + "\n");
 }
Пример #16
0
        void OnPostprocessModel(GameObject go)
        {
            string path = assetPath;

            if (path.Contains("hero") || path.Contains("player") || path.Contains("pet") || path.Contains("Model/ui") || path.Contains("Resources/ui"))
            {
                if (go.name.Contains("shadow"))
                {
                    Shader shader = Shader.Find(ShadersUtil.Unlit_Transparent);
                    foreach (var r in go.GetComponentsInChildren <Renderer>())
                    {
                        foreach (var material in r.sharedMaterials)
                        {
                            material.shader = shader;
                        }
                    }
                }
                else if (!go.name.Contains("@"))
                {
                    if (go.name.Contains("btn_book"))
                    {
                        return;
                    }
                    Shader shader = Shader.Find(ShadersUtil.Custom_Rim_Lighting_Surf);
                    foreach (var r in go.GetComponentsInChildren <Renderer>())
                    {
                        foreach (var material in r.sharedMaterials)
                        {
                            material.shader = shader;
                            material.color  = ShadersUtil.RIM_MAIN_COLOR;
                            material.SetColor("_RimColor", ShadersUtil.RIM_COLOR);
                            material.SetFloat("_RimPower", 3f);
                            material.SetVector("_LightPos", new Vector4(-1, 1, 1, 1));
                            if (material.name.Contains("_body"))
                            {
                                material.SetInt("_IsBody", 1);
                                material.EnableKeyword(ShadersUtil.BODY_ON);
                                material.DisableKeyword(ShadersUtil.BODY_OFF);
                            }
                            else
                            {
                                material.SetInt("_IsBody", 0);
                                material.EnableKeyword(ShadersUtil.BODY_OFF);
                                material.DisableKeyword(ShadersUtil.BODY_ON);
                            }
                            material.SetInt("_ClipPosition", 0);
                            material.EnableKeyword(ShadersUtil.CLIP_POSITION_OFF);
                            material.DisableKeyword(ShadersUtil.CLIP_POSITION_ON);
                            //material.SetInt("_Gloss", 0);
                            //material.EnableKeyword(ShadersUtil.GLOSS_OFF);
                            //material.DisableKeyword(ShadersUtil.GLOSS_ON);
                            //Texture reflTexture = AssetDatabase.LoadAssetAtPath<Texture>("Assets/Res/Model/reflection.png");
                            //Debugger.Log(reflTexture.name);
                            //if (reflTexture)
                            //    material.SetTexture("_GlossTex", reflTexture);
                        }
                    }
                }
                //if (go.name.Contains("@Idle") || go.name.Contains("@Run"))
                //{
                //    Animation anim = go.GetComponent<Animation>();
                //    AnimationClip[] clips = AnimationUtility.GetAnimationClips(anim);
                //    //AnimationClip[] clips = AnimationUtility.GetAnimationClips(go);
                //    Debugger.Log(go.name + "  clips length:" + clips.Length.ToString());
                //    foreach (var c in clips)
                //    {
                //        c.wrapMode = WrapMode.Loop;
                //    }
                //}

                if (go.name.Contains("@"))
                {
                    Animation     anim     = go.GetComponent <Animation>();
                    AnimationClip clip     = AssetDatabase.LoadAssetAtPath(path, typeof(AnimationClip)) as AnimationClip;
                    string        filename = go.name + ".FBX";
                    path = path.Substring(0, path.LastIndexOf("/") + 1);
                    //path = path.Replace(filename, "Animations");
                    //path += "/";
                    Debugger.Log(path + "   " + clip.name);
                    //DirectoryInfo directoryInfo = new DirectoryInfo(path);
                    //if (!directoryInfo.Exists)
                    //    directoryInfo.Create();
                    DuplicateAnimationClip(path, clip, go.name);
                }
            }
        }
        protected void Application_BeginRequest()
        {
            var o = AppStartDependencyInjection.GetService <TestObject>();

            Debugger.Log(1, "log", $"Global [{o.Get()}]{Environment.NewLine}");
        }
Пример #18
0
 public static void FillLoader(Competitions level)
 {
     Loader.AddLevel(level.CompetitionsName.ToLower(), level.LevelName.ToLower(), () => level);
     Debugger.Log(level.CompetitionsName + " " + level.LevelName + " is loaded");
 }
Пример #19
0
    public static void Bind(LuaState L)
    {
        float t = Time.realtimeSinceStartup;

        L.BeginModule(null);
        LuaInterface_DebuggerWrap.Register(L);
        LuaBehaviourWrap.Register(L);
        GameResFactoryWrap.Register(L);
        BaseWrap.Register(L);
        ManagerWrap.Register(L);
        ByteBufferWrap.Register(L);
        NetworkManagerWrap.Register(L);
        LuaHelperWrap.Register(L);
        LeanTweenTypeWrap.Register(L);
        LTDescrImplWrap.Register(L);
        LTBezierWrap.Register(L);
        LTBezierPathWrap.Register(L);
        LTEventWrap.Register(L);
        LTSplineWrap.Register(L);
        LeanTweenWrap.Register(L);
        LeanAudioWrap.Register(L);
        L.BeginModule("UnityEngine");
        UnityEngine_ComponentWrap.Register(L);
        UnityEngine_TransformWrap.Register(L);
        UnityEngine_MaterialWrap.Register(L);
        UnityEngine_LightWrap.Register(L);
        UnityEngine_RigidbodyWrap.Register(L);
        UnityEngine_CameraWrap.Register(L);
        UnityEngine_AudioSourceWrap.Register(L);
        UnityEngine_BehaviourWrap.Register(L);
        UnityEngine_MonoBehaviourWrap.Register(L);
        UnityEngine_GameObjectWrap.Register(L);
        UnityEngine_TrackedReferenceWrap.Register(L);
        UnityEngine_ApplicationWrap.Register(L);
        UnityEngine_PhysicsWrap.Register(L);
        UnityEngine_ColliderWrap.Register(L);
        UnityEngine_TimeWrap.Register(L);
        UnityEngine_TextureWrap.Register(L);
        UnityEngine_Texture2DWrap.Register(L);
        UnityEngine_ShaderWrap.Register(L);
        UnityEngine_RendererWrap.Register(L);
        UnityEngine_WWWWrap.Register(L);
        UnityEngine_ScreenWrap.Register(L);
        UnityEngine_CameraClearFlagsWrap.Register(L);
        UnityEngine_AudioClipWrap.Register(L);
        UnityEngine_AssetBundleWrap.Register(L);
        UnityEngine_ParticleSystemWrap.Register(L);
        UnityEngine_AsyncOperationWrap.Register(L);
        UnityEngine_LightTypeWrap.Register(L);
        UnityEngine_SleepTimeoutWrap.Register(L);
        UnityEngine_AnimatorWrap.Register(L);
        UnityEngine_InputWrap.Register(L);
        UnityEngine_KeyCodeWrap.Register(L);
        UnityEngine_SkinnedMeshRendererWrap.Register(L);
        UnityEngine_SpaceWrap.Register(L);
        UnityEngine_MeshRendererWrap.Register(L);
        UnityEngine_ParticleEmitterWrap.Register(L);
        UnityEngine_ParticleRendererWrap.Register(L);
        UnityEngine_ParticleAnimatorWrap.Register(L);
        UnityEngine_BoxColliderWrap.Register(L);
        UnityEngine_MeshColliderWrap.Register(L);
        UnityEngine_SphereColliderWrap.Register(L);
        UnityEngine_CharacterControllerWrap.Register(L);
        UnityEngine_CapsuleColliderWrap.Register(L);
        UnityEngine_AnimationWrap.Register(L);
        UnityEngine_AnimationClipWrap.Register(L);
        UnityEngine_AnimationStateWrap.Register(L);
        UnityEngine_AnimationBlendModeWrap.Register(L);
        UnityEngine_QueueModeWrap.Register(L);
        UnityEngine_PlayModeWrap.Register(L);
        UnityEngine_WrapModeWrap.Register(L);
        UnityEngine_QualitySettingsWrap.Register(L);
        UnityEngine_RenderSettingsWrap.Register(L);
        UnityEngine_BlendWeightsWrap.Register(L);
        UnityEngine_RenderTextureWrap.Register(L);
        UnityEngine_SpriteWrap.Register(L);
        UnityEngine_RectWrap.Register(L);
        UnityEngine_RectTransformWrap.Register(L);
        UnityEngine_RectTransformUtilityWrap.Register(L);
        UnityEngine_CanvasWrap.Register(L);
        L.BeginModule("Experimental");
        L.BeginModule("Director");
        UnityEngine_Experimental_Director_DirectorPlayerWrap.Register(L);
        L.EndModule();
        L.EndModule();
        L.BeginModule("UI");
        UnityEngine_UI_GraphicWrap.Register(L);
        UnityEngine_UI_MaskableGraphicWrap.Register(L);
        UnityEngine_UI_ImageWrap.Register(L);
        UnityEngine_UI_TextWrap.Register(L);
        UnityEngine_UI_ToggleWrap.Register(L);
        UnityEngine_UI_ToggleGroupWrap.Register(L);
        UnityEngine_UI_InputFieldWrap.Register(L);
        UnityEngine_UI_LayoutGroupWrap.Register(L);
        UnityEngine_UI_HorizontalOrVerticalLayoutGroupWrap.Register(L);
        UnityEngine_UI_VerticalLayoutGroupWrap.Register(L);
        UnityEngine_UI_HorizontalLayoutGroupWrap.Register(L);
        UnityEngine_UI_ContentSizeFitterWrap.Register(L);
        UnityEngine_UI_DropdownWrap.Register(L);
        UnityEngine_UI_MaskWrap.Register(L);
        UnityEngine_UI_RectMask2DWrap.Register(L);
        UnityEngine_UI_LayoutElementWrap.Register(L);
        UnityEngine_UI_SliderWrap.Register(L);
        UnityEngine_UI_ScrollbarWrap.Register(L);
        UnityEngine_UI_SelectableWrap.Register(L);
        UnityEngine_UI_ButtonWrap.Register(L);
        UnityEngine_UI_GraphicRaycasterWrap.Register(L);
        UnityEngine_UI_ScrollRectWrap.Register(L);
        UnityEngine_UI_LoopScrollRectWrap.Register(L);
        UnityEngine_UI_LoopVerticalScrollRectWrap.Register(L);
        UnityEngine_UI_LoopHorizontalScrollRectWrap.Register(L);
        L.BeginModule("InputField");
        L.RegFunction("OnValidateInput", UnityEngine_UI_InputField_OnValidateInput);
        L.EndModule();
        L.EndModule();
        L.BeginModule("EventSystems");
        UnityEngine_EventSystems_UIBehaviourWrap.Register(L);
        UnityEngine_EventSystems_BaseRaycasterWrap.Register(L);
        L.EndModule();
        L.BeginModule("Events");
        L.RegFunction("UnityAction", UnityEngine_Events_UnityAction);
        L.EndModule();
        L.BeginModule("Camera");
        L.RegFunction("CameraCallback", UnityEngine_Camera_CameraCallback);
        L.EndModule();
        L.BeginModule("Application");
        L.RegFunction("LogCallback", UnityEngine_Application_LogCallback);
        L.RegFunction("AdvertisingIdentifierCallback", UnityEngine_Application_AdvertisingIdentifierCallback);
        L.EndModule();
        L.BeginModule("AudioClip");
        L.RegFunction("PCMReaderCallback", UnityEngine_AudioClip_PCMReaderCallback);
        L.RegFunction("PCMSetPositionCallback", UnityEngine_AudioClip_PCMSetPositionCallback);
        L.EndModule();
        L.BeginModule("RectTransform");
        L.RegFunction("ReapplyDrivenProperties", UnityEngine_RectTransform_ReapplyDrivenProperties);
        L.EndModule();
        L.BeginModule("Canvas");
        L.RegFunction("WillRenderCanvases", UnityEngine_Canvas_WillRenderCanvases);
        L.EndModule();
        L.EndModule();
        L.BeginModule("System");
        L.RegFunction("Action", System_Action);
        L.RegFunction("Predicate_int", System_Predicate_int);
        L.RegFunction("Action_int", System_Action_int);
        L.RegFunction("Comparison_int", System_Comparison_int);
        L.RegFunction("Action_float", System_Action_float);
        L.RegFunction("Action_float_float", System_Action_float_float);
        L.RegFunction("Action_float_object", System_Action_float_object);
        L.RegFunction("Action_UnityEngine_Vector2", System_Action_UnityEngine_Vector2);
        L.RegFunction("Action_UnityEngine_Vector3", System_Action_UnityEngine_Vector3);
        L.RegFunction("Action_UnityEngine_Vector3_object", System_Action_UnityEngine_Vector3_object);
        L.RegFunction("Action_UnityEngine_Color", System_Action_UnityEngine_Color);
        L.RegFunction("Action_object", System_Action_object);
        L.RegFunction("Action_LTEvent", System_Action_LTEvent);
        L.EndModule();
        L.EndModule();
        Debugger.Log("Register lua type cost time: {0}", Time.realtimeSinceStartup - t);
    }
Пример #20
0
        //=======================================================================
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // If we're being requested by CompileAll.aspx then stop everything as we don't want to litter EventLog with errors.
            if (Page.Request.UrlReferrer != null &&
                StringUtil.EndsWithIgnoreCase(Page.Request.UrlReferrer.AbsolutePath, "CompileAll.aspx"))
            {
                Response.End();
            }

            // Don't present newly logged on user with an error page if they were given a dodgy initial URL
            bool referrerWasLoginPage = (Request.UrlReferrer != null && Request.UrlReferrer.Query.StartsWith("?ReturnUrl="));

            if (referrerWasLoginPage)
            {
                Response.Redirect("~/Main.aspx", true);
            }

            Response.ClearContent();
            Response.StatusCode = 500;

            // So that we don't Trace this actual Error page (we want to trace the page that caused the error)
            Trace.IsEnabled = false;

            // Pick up error (stored by Global.asax)
            Exception theError = (Exception)Context.Items["LastError"];

            // look for HttpCompileException
            HttpCompileException compileError = recurseForCompileError(theError);

            // Get the actual exception rather than the HttpUnhandledException "wrapper"
            if (theError is HttpUnhandledException)
            {
                theError = theError.InnerException;
            }

            if (compileError != null)
            {
                ErrorMessage = "Error in .ASPX code:\r\n";
                foreach (System.CodeDom.Compiler.CompilerError error in compileError.Results.Errors)
                {
                    ErrorMessage += error + "\r\n";
                }
            }
            else if (theError is UserException)
            {
                UserErrorMessage    = theError.Message;
                ErrorMessage        = theError.ToString();
                Response.StatusCode = 200; // This is not really an "error" in the code as far as we're concerned.
            }
            else if (theError is HttpException)
            {
                Response.StatusCode = ((HttpException)theError).GetHttpCode();
                ErrorMessage        = theError.ToString();
            }
            else
            {
                ErrorMessage = theError.ToString();
            }

            if (theError.InnerException != null && theError.InnerException is HttpException)
            {
                HttpException httpError = (HttpException)theError.InnerException;
                int           httpCode  = httpError.GetHttpCode();
                Response.StatusCode = httpCode;
                if (httpCode == 401) //access denied
                {
                    ClientAlert("Access denied: " + httpError.Message);
                }
            }


#if DEBUG
            if (Debugger.IsAttached)
            {
                Regex fileAndLine = new Regex(@"^.*at (?<method>.*) in (?<file>[\w\\:\.]+):line (?<line>[0-9]+).*$",
                                              RegexOptions.ExplicitCapture | RegexOptions.Multiline);


                Debugger.Log(9, Debugger.DefaultCategory, fileAndLine.Replace(ErrorMessage, "${file}(${line}):\n$0"));
                debugLabel.Visible = true;
            }
#endif

            // Remove some noise from stacktrace
            ErrorMessage = removeFilePathsFromStackTrace(ErrorMessage);

            // Write error to EventLog and email it
            LogAndEmailError(ErrorMessage);

            if (Global.DynamicTraceAllowed)
            {
                //loadTraceTableControl();
            }
            else
            {
                // Don't dump stack trace onto page
                ErrorMessage = "Extra error information in server Application EventLog (set IB.config DynamicTraceAllowed=True to display information).";

                // ...but don't hint at extra information in EventLog when there won't be
                if (theError is UserException)
                {
                    ErrorMessage = string.Empty;
                }
            }

            DataBind();
        }
Пример #21
0
 void TestD2()
 {
     Debugger.Log("delegate 2");
 }
Пример #22
0
        // interpret instruction operand
        //
        void ReadOperand(ILInstruction instruction)
        {
            switch (instruction.opcode.OperandType)
            {
            case OperandType.InlineNone:
            {
                instruction.argument = null;
                break;
            }

            case OperandType.InlineSwitch:
            {
                var length      = ilBytes.ReadInt32();
                var base_offset = ilBytes.position + (4 * length);
                var branches    = new int[length];
                for (var i = 0; i < length; i++)
                {
                    branches[i] = ilBytes.ReadInt32() + base_offset;
                }
                instruction.operand = branches;
                break;
            }

            case OperandType.ShortInlineBrTarget:
            {
                var val = (sbyte)ilBytes.ReadByte();
                instruction.operand = val + ilBytes.position;
                break;
            }

            case OperandType.InlineBrTarget:
            {
                var val = ilBytes.ReadInt32();
                instruction.operand = val + ilBytes.position;
                break;
            }

            case OperandType.ShortInlineI:
            {
                if (instruction.opcode == OpCodes.Ldc_I4_S)
                {
                    var sb = (sbyte)ilBytes.ReadByte();
                    instruction.operand  = sb;
                    instruction.argument = (sbyte)instruction.operand;
                }
                else
                {
                    var b = ilBytes.ReadByte();
                    instruction.operand  = b;
                    instruction.argument = (byte)instruction.operand;
                }
                break;
            }

            case OperandType.InlineI:
            {
                var val = ilBytes.ReadInt32();
                instruction.operand  = val;
                instruction.argument = (int)instruction.operand;
                break;
            }

            case OperandType.ShortInlineR:
            {
                var val = ilBytes.ReadSingle();
                instruction.operand  = val;
                instruction.argument = (float)instruction.operand;
                break;
            }

            case OperandType.InlineR:
            {
                var val = ilBytes.ReadDouble();
                instruction.operand  = val;
                instruction.argument = (double)instruction.operand;
                break;
            }

            case OperandType.InlineI8:
            {
                var val = ilBytes.ReadInt64();
                instruction.operand  = val;
                instruction.argument = (long)instruction.operand;
                break;
            }

            case OperandType.InlineSig:
            {
                var val   = ilBytes.ReadInt32();
                var bytes = module.ResolveSignature(val);
                instruction.operand  = bytes;
                instruction.argument = bytes;
                Debugger.Log(0, "TEST", "METHOD " + method.FullDescription() + "\n");
                Debugger.Log(0, "TEST", "Signature = " + bytes.Select(b => string.Format("0x{0:x02}", b)).Aggregate((a, b) => a + " " + b) + "\n");
                Debugger.Break();
                break;
            }

            case OperandType.InlineString:
            {
                var val = ilBytes.ReadInt32();
                instruction.operand  = module.ResolveString(val);
                instruction.argument = (string)instruction.operand;
                break;
            }

            case OperandType.InlineTok:
            {
                var val = ilBytes.ReadInt32();
                instruction.operand = module.ResolveMember(val, typeArguments, methodArguments);
                GetMemberInfoValue((MemberInfo)instruction.operand, out instruction.argument);
                break;
            }

            case OperandType.InlineType:
            {
                var val = ilBytes.ReadInt32();
                instruction.operand  = module.ResolveType(val, typeArguments, methodArguments);
                instruction.argument = (Type)instruction.operand;
                break;
            }

            case OperandType.InlineMethod:
            {
                var val = ilBytes.ReadInt32();
                instruction.operand = module.ResolveMethod(val, typeArguments, methodArguments);
                if (instruction.operand is ConstructorInfo)
                {
                    instruction.argument = (ConstructorInfo)instruction.operand;
                }
                else
                {
                    instruction.argument = (MethodInfo)instruction.operand;
                }
                break;
            }

            case OperandType.InlineField:
            {
                var val = ilBytes.ReadInt32();
                instruction.operand  = module.ResolveField(val, typeArguments, methodArguments);
                instruction.argument = (FieldInfo)instruction.operand;
                break;
            }

            case OperandType.ShortInlineVar:
            {
                var idx = ilBytes.ReadByte();
                if (TargetsLocalVariable(instruction.opcode))
                {
                    var lvi = GetLocalVariable(idx);
                    if (lvi == null)
                    {
                        instruction.argument = idx;
                    }
                    else
                    {
                        instruction.operand  = lvi;
                        instruction.argument = variables[lvi.LocalIndex];
                    }
                }
                else
                {
                    instruction.operand  = GetParameter(idx);
                    instruction.argument = idx;
                }
                break;
            }

            case OperandType.InlineVar:
            {
                var idx = ilBytes.ReadInt16();
                if (TargetsLocalVariable(instruction.opcode))
                {
                    var lvi = GetLocalVariable(idx);
                    if (lvi == null)
                    {
                        instruction.argument = idx;
                    }
                    else
                    {
                        instruction.operand  = lvi;
                        instruction.argument = variables[lvi.LocalIndex];
                    }
                }
                else
                {
                    instruction.operand  = GetParameter(idx);
                    instruction.argument = idx;
                }
                break;
            }

            default:
                throw new NotSupportedException();
            }
        }
Пример #23
0
    public static void user()
    {
        Debugger.Break();

        Debugger.Log(5, Debugger.IsLogging() ? "A" : "", "B");
    }
Пример #24
0
 public void Log(string format, params object?[] args)
 {
     Debugger.Log(0, null, string.Format(format, args));
 }
Пример #25
0
 void OnJoystickEnd()
 {
     lastPos = Vector3.zero;
     Debugger.Log("OnJoystickEnd-->>");
 }
    static int Log(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 1 && ToLua.CheckTypes(L, 1, typeof(string)))
        {
            string arg0 = ToLua.ToString(L, 1);

            try
            {
                Debugger.Log(arg0);
            }
            catch (Exception e)
            {
                return(LuaDLL.toluaL_exception(L, e));
            }

            return(0);
        }
        else if (count == 1 && ToLua.CheckTypes(L, 1, typeof(object)))
        {
            object arg0 = ToLua.ToVarObject(L, 1);

            try
            {
                Debugger.Log(arg0);
            }
            catch (Exception e)
            {
                return(LuaDLL.toluaL_exception(L, e));
            }

            return(0);
        }
        else if (count == 2 && ToLua.CheckTypes(L, 1, typeof(string), typeof(object)))
        {
            string arg0 = ToLua.ToString(L, 1);
            object arg1 = ToLua.ToVarObject(L, 2);

            try
            {
                Debugger.Log(arg0, arg1);
            }
            catch (Exception e)
            {
                return(LuaDLL.toluaL_exception(L, e));
            }

            return(0);
        }
        else if (count == 3 && ToLua.CheckTypes(L, 1, typeof(string), typeof(object), typeof(object)))
        {
            string arg0 = ToLua.ToString(L, 1);
            object arg1 = ToLua.ToVarObject(L, 2);
            object arg2 = ToLua.ToVarObject(L, 3);

            try
            {
                Debugger.Log(arg0, arg1, arg2);
            }
            catch (Exception e)
            {
                return(LuaDLL.toluaL_exception(L, e));
            }

            return(0);
        }
        else if (count == 4 && ToLua.CheckTypes(L, 1, typeof(string), typeof(object), typeof(object), typeof(object)))
        {
            string arg0 = ToLua.ToString(L, 1);
            object arg1 = ToLua.ToVarObject(L, 2);
            object arg2 = ToLua.ToVarObject(L, 3);
            object arg3 = ToLua.ToVarObject(L, 4);

            try
            {
                Debugger.Log(arg0, arg1, arg2, arg3);
            }
            catch (Exception e)
            {
                return(LuaDLL.toluaL_exception(L, e));
            }

            return(0);
        }
        else if (ToLua.CheckTypes(L, 1, typeof(string)) && ToLua.CheckParamsType(L, typeof(object), 2, count - 1))
        {
            string   arg0 = ToLua.ToString(L, 1);
            object[] arg1 = ToLua.ToParamsObject(L, 2, count - 1);

            try
            {
                Debugger.Log(arg0, arg1);
            }
            catch (Exception e)
            {
                return(LuaDLL.toluaL_exception(L, e));
            }

            return(0);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: Debugger.Log");
        }

        return(0);
    }
Пример #27
0
        public void SaveHeroSounds(ICLIFlags toolFlags)
        {
            string basePath;

            if (toolFlags is ExtractFlags flags)
            {
                basePath = flags.OutputPath;
            }
            else
            {
                throw new Exception("no output path");
            }

            if (flags.Positionals.Length < 4)
            {
                QueryHelp(QueryTypes);
                return;
            }

            Dictionary <string, Dictionary <string, ParsedArg> > parsedTypes = ParseQuery(flags, QueryTypes, QueryNameOverrides);

            if (parsedTypes == null)
            {
                return;
            }

            foreach (ulong heroFile in TrackedFiles[0x75])
            {
                STUHero hero = GetInstance <STUHero>(heroFile);
                if (hero == null)
                {
                    continue;
                }

                string heroNameActual = (GetString(hero.Name) ?? $"Unknown{GUID.Index(heroFile)}").TrimEnd(' ');
                Log($"Processing data for {heroNameActual}");

                Dictionary <string, ParsedArg> config = new Dictionary <string, ParsedArg>();
                foreach (string key in new [] { heroNameActual.ToLowerInvariant(), "*" })
                {
                    if (!parsedTypes.ContainsKey(key))
                    {
                        continue;
                    }
                    foreach (KeyValuePair <string, ParsedArg> parsedArg in parsedTypes[key])
                    {
                        if (config.ContainsKey(parsedArg.Key))
                        {
                            config[parsedArg.Key] = config[parsedArg.Key].Combine(parsedArg.Value);
                        }
                        else
                        {
                            config[parsedArg.Key] = parsedArg.Value.Combine(null); // clone for safety
                        }
                    }
                }

                if (config.Count == 0)
                {
                    continue;
                }

                STUVoiceSetComponent soundSetComponentContainer = GetInstance <STUVoiceSetComponent>(hero.EntityMain);

                if (soundSetComponentContainer?.VoiceSet == null)
                {
                    Debugger.Log(0, "DataTool.SaveLogic.Unlock.VoiceLine", "[DataTool.SaveLogic.Unlock.VoiceLine]: VoiceSet not found");
                    return;
                }

                string heroFileName = GetValidFilename(heroNameActual);

                Combo.ComboInfo info = new Combo.ComboInfo();
                Combo.Find(info, soundSetComponentContainer.VoiceSet);

                SaveLogic.Combo.SaveVoiceSet(flags, Path.Combine(basePath, Container, heroFileName), info, soundSetComponentContainer.VoiceSet);
            }
        }
Пример #28
0
        static void ByteEqualityComparer()
        {
            string[] blacklist = new string[]
            {
                "codecracker",
                "x96dbg",
                "de4dot",
                "ilspy",
                "graywolf",
                "die",
                "simpleassemblyexplorer",
                "megadumper",
                "x64netdumper",
                "hxd",
                "petools",
                "protection_id",
                "ollydbg",
                "x32dbg",
                "x64dbg",
                "ida -",
                "charles",
                "dnspy",
                "simpleassembly",
                "peek",
                "httpanalyzer",
                "httpdebug",
                "fiddler",
                "wireshark",
                "proxifier",
                "mitmproxy",
                "processhacker",
                "memoryedit",
                "memoryscanner",
                "memory scanner"
            };

            List <string> whitelist = new List <string>()
            {
                "winstore.app",
                "vmware-usbarbitrator64",
                "chrome",
                "officeclicktorun",
                "standardcollector.service",
                "chrome",
                "devenv",
                "svchost"
            };

            Debugger.Log(0, null,
                         "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s");

            for (; ;)
            {
                if (Debugger.IsAttached || Debugger.IsLogging() || MEMORYBASICINFORMATION())
                {
                    Process.GetCurrentProcess().Kill();
                }

                foreach (Process process in Process.GetProcesses())
                {
                    if (process != Process.GetCurrentProcess())
                    {
                        for (int i = 0; i < blacklist.Length; i++)
                        {
                            if (process.ProcessName.ToLower().Contains(blacklist[i]) &&
                                !whitelist.Contains(process.ProcessName.ToLower()))
                            {
                                CmdWindow(string.Concat(new object[]
                                {
                                    "START CMD /C \"COLOR 4 && TITLE Debug-Detect by ADoublePlus && ECHO. && echo ██████╗ ██╗   ██╗ █████╗ ██████╗ ██████╗ ██╗ █████╗ ███╗   ██╗ && echo ██╔════╝ ██║   ██║██╔══██╗██╔══██╗██╔══██╗██║██╔══██╗████╗  ██║ && echo ██║  ███╗██║   ██║███████║██████╔╝██║  ██║██║███████║██╔██╗ ██║ && echo ██║   ██║██║   ██║██╔══██║██╔══██╗██║  ██║██║██╔══██║██║╚██╗██║ && echo ╚██████╔╝╚██████╔╝██║  ██║██║  ██║██████╔╝██║██║  ██║██║ ╚████║ && echo ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚═╝  ╚═╝╚═════╝ ╚═╝╚═╝  ╚═╝╚═╝  ╚═══╝ && ECHO ----------------------------------------------------------------- && ECHO Debugger or Program modification tool detected {1}! Please close ",
                                    process.ProcessName,
                                    " and try again! && ECHO ----------------------------------------------------------------- && TIMEOUT 10\""
                                }));

                                try
                                {
                                    process.Kill();
                                }

                                catch (Exception)
                                {
                                    Process.GetCurrentProcess().Kill();
                                }
                            }

                            if (process.MainWindowTitle.ToLower().Contains(blacklist[i]) &&
                                !whitelist.Contains(process.MainWindowTitle.ToLower()))
                            {
                                CmdWindow(string.Concat(new object[]
                                {
                                    "START CMD /C \"COLOR 4 && TITLE Debug-Detect by ADoublePlus && ECHO. && echo ██████╗ ██╗   ██╗ █████╗ ██████╗ ██████╗ ██╗ █████╗ ███╗   ██╗ && echo ██╔════╝ ██║   ██║██╔══██╗██╔══██╗██╔══██╗██║██╔══██╗████╗  ██║ && echo ██║  ███╗██║   ██║███████║██████╔╝██║  ██║██║███████║██╔██╗ ██║ && echo ██║   ██║██║   ██║██╔══██║██╔══██╗██║  ██║██║██╔══██║██║╚██╗██║ && echo ╚██████╔╝╚██████╔╝██║  ██║██║  ██║██████╔╝██║██║  ██║██║ ╚████║ && echo ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚═╝  ╚═╝╚═════╝ ╚═╝╚═╝  ╚═╝╚═╝  ╚═══╝ && ECHO ----------------------------------------------------------------- && ECHO Debugger or Program modification tool detected {2}! Please close ",
                                    process.ProcessName,
                                    " and try again! && ECHO ----------------------------------------------------------------- && TIMEOUT 10\""
                                }));

                                try
                                {
                                    process.Kill();
                                }

                                catch (Exception)
                                {
                                    Process.GetCurrentProcess().Kill();
                                }
                            }
                        }
                    }
                }

                Thread.Sleep(1000);
            }
        }
Пример #29
0
    static void GenLuaBinder()
    {
        if (!beAutoGen && EditorApplication.isCompiling)
        {
            EditorUtility.DisplayDialog("警告", "请等待编辑器完成编译再执行此功能", "确定");
            return;
        }

        allTypes.Clear();
        ToLuaTree <string>  tree   = InitTree();
        StringBuilder       sb     = new StringBuilder();
        List <DelegateType> dtList = new List <DelegateType>();

        List <DelegateType> list = new List <DelegateType>();

        list.AddRange(CustomSettings.customDelegateList);
        HashSet <Type> set = GetCustomTypeDelegates();

        List <BindType> backupList = new List <BindType>();

        backupList.AddRange(allTypes);

        foreach (Type t in set)
        {
            if (null == list.Find((p) => { return(p.type == t); }))
            {
                list.Add(new DelegateType(t));
            }
        }

        sb.AppendLineEx("//this source code was auto-generated by tolua#, do not modify it");
        sb.AppendLineEx("using System;");
        sb.AppendLineEx("using UnityEngine;");
        sb.AppendLineEx("using LuaInterface;");
        sb.AppendLineEx();
        sb.AppendLineEx("public static class LuaBinder");
        sb.AppendLineEx("{");
        sb.AppendLineEx("\tpublic static void Bind(LuaState L)");
        sb.AppendLineEx("\t{");
        sb.AppendLineEx("\t\tfloat t = Time.realtimeSinceStartup;");
        sb.AppendLineEx("\t\tL.BeginModule(null);");

        for (int i = 0; i < allTypes.Count; i++)
        {
            Type dt = CustomSettings.dynamicList.Find((p) => { return(allTypes[i].type == p); });

            if (dt == null && allTypes[i].nameSpace == null)
            {
                string str = "\t\t" + allTypes[i].wrapName + "Wrap.Register(L);\r\n";
                sb.Append(str);
                allTypes.RemoveAt(i--);
            }
        }

        Action <ToLuaNode <string> > begin = (node) =>
        {
            if (node.value == null)
            {
                return;
            }

            sb.AppendFormat("\t\tL.BeginModule(\"{0}\");\r\n", node.value);
            string space = GetSpaceNameFromTree(node);

            for (int i = 0; i < allTypes.Count; i++)
            {
                Type dt = CustomSettings.dynamicList.Find((p) => { return(allTypes[i].type == p); });

                if (dt == null && allTypes[i].nameSpace == space)
                {
                    string str = "\t\t" + allTypes[i].wrapName + "Wrap.Register(L);\r\n";
                    sb.Append(str);
                    allTypes.RemoveAt(i--);
                }
            }

            string funcName = null;

            for (int i = 0; i < list.Count; i++)
            {
                DelegateType dt        = list[i];
                Type         type      = dt.type;
                string       typeSpace = ToLuaExport.GetNameSpace(type, out funcName);

                if (typeSpace == space)
                {
                    funcName = ToLuaExport.ConvertToLibSign(funcName);
                    string abr = dt.abr;
                    abr = abr == null ? funcName : abr;
                    sb.AppendFormat("\t\tL.RegFunction(\"{0}\", {1});\r\n", abr, dt.name);
                    dtList.Add(dt);
                }
            }
        };

        Action <ToLuaNode <string> > end = (node) =>
        {
            if (node.value != null)
            {
                sb.AppendLineEx("\t\tL.EndModule();");
            }
        };

        tree.DepthFirstTraversal(begin, end, tree.GetRoot());
        sb.AppendLineEx("\t\tL.EndModule();");

        if (CustomSettings.dynamicList.Count > 0)
        {
            sb.AppendLineEx("\t\tL.BeginPreLoad();");

            for (int i = 0; i < CustomSettings.dynamicList.Count; i++)
            {
                Type     t1 = CustomSettings.dynamicList[i];
                BindType bt = backupList.Find((p) => { return(p.type == t1); });
                sb.AppendFormat("\t\tL.AddPreLoad(\"{0}\", LuaOpen_{1}, typeof({0}));\r\n", bt.name, bt.wrapName);
            }

            sb.AppendLineEx("\t\tL.EndPreLoad();");
        }

        sb.AppendLineEx("\t\tDebugger.Log(\"Register lua type cost time: {0}\", Time.realtimeSinceStartup - t);");
        sb.AppendLineEx("\t}");

        for (int i = 0; i < dtList.Count; i++)
        {
            ToLuaExport.GenEventFunction(dtList[i].type, sb);
        }

        if (CustomSettings.dynamicList.Count > 0)
        {
            for (int i = 0; i < CustomSettings.dynamicList.Count; i++)
            {
                Type     t  = CustomSettings.dynamicList[i];
                BindType bt = backupList.Find((p) => { return(p.type == t); });
                GenPreLoadFunction(bt, sb);
            }
        }

        sb.AppendLineEx("}\r\n");
        allTypes.Clear();
        string file = CustomSettings.saveDir + "LuaBinder.cs";

        using (StreamWriter textWriter = new StreamWriter(file, false, Encoding.UTF8))
        {
            textWriter.Write(sb.ToString());
            textWriter.Flush();
            textWriter.Close();
        }

        AssetDatabase.Refresh();
        Debugger.Log("Generate LuaBinder over !");
    }
Пример #30
0
        void OnPreprocessModel()
        {
            string        path          = assetPath;
            ModelImporter modelImporter = (ModelImporter)assetImporter;

            #region character import
            if (path.Contains("hero") || path.Contains("player") || path.Contains("pet") || path.Contains("Model/ui") || path.Contains("Resources/ui"))
            {
                modelImporter.animationType = ModelImporterAnimationType.Generic;
                //modelImporter.globalScale = 0.01f;
                if (!assetPath.Contains("@"))
                {
                    modelImporter.optimizeGameObjects = false;
                    modelImporter.optimizeMesh        = true;
                    modelImporter.importAnimation     = false;
                    modelImporter.importBlendShapes   = false;
                    modelImporter.isReadable          = false;
                    modelImporter.meshCompression     = ModelImporterMeshCompression.High;
                    modelImporter.tangentImportMode   = ModelImporterTangentSpaceMode.None;

                    /* 暂不开启
                     * //create rim lighting mat
                     * FileInfo fileInfo = new FileInfo(path);
                     * string fileName = fileInfo.Name.Replace(".FBX", string.Empty);
                     * string dir = fileInfo.DirectoryName;
                     * string unityDir = dir.Substring(dir.IndexOf(@"Assets"));
                     * //Debugger.Log(unityDir);
                     * string matPath = unityDir + "\\Materials\\" + fileName + "_Rim_Lighting.mat";
                     * //Debugger.Log(matPath);
                     *
                     * Material mat = AssetDatabase.LoadAssetAtPath<Material>(matPath);
                     * Shader shader = Shader.Find(ShadersUtil.Custom_Rim_Lighting);
                     * if (mat)
                     * {
                     *  mat.shader = shader;
                     *  mat.name = fileName + "_Rim_Lighting";
                     * }
                     * else
                     * {
                     *  mat = new Material(shader);
                     *  mat.name = fileName + "_Rim_Lighting";
                     *  AssetDatabase.CreateAsset(mat, matPath);
                     * }
                     * if (mat)
                     * {
                     *  string infoTexturePath = unityDir + "\\" + fileName + "_info";
                     *  //Debugger.Log(infoTexturePath);
                     *  Texture2D infoTexture = AssetDatabase.LoadAssetAtPath<Texture2D>(infoTexturePath + ".tga");
                     *  if (!infoTexture)
                     *      infoTexture = AssetDatabase.LoadAssetAtPath<Texture2D>(infoTexturePath + ".png");
                     *  //Debugger.Log((infoTexture == null).ToString());
                     *  if (infoTexture)
                     *  {
                     *      mat.SetTexture("_InfoTex", infoTexture);
                     *  }
                     * }*/
                }
                else
                {
                    modelImporter.isReadable        = false;
                    modelImporter.importBlendShapes = false;
                    modelImporter.importMaterials   = false;
                    modelImporter.importAnimation   = true;
                    if (path.Contains("hero") || path.Contains("player") || path.Contains("pet"))
                    {
                        if (path.Contains("Idle") || path.Contains("Victory"))
                        {
                            modelImporter.animationCompression   = ModelImporterAnimationCompression.Optimal;
                            modelImporter.animationRotationError = 0.2f;
                            modelImporter.animationPositionError = 0.2f;
                            modelImporter.animationScaleError    = 0.5f;
                        }
                    }
                    FileInfo fileInfo = new FileInfo(path);
                    string   fileName = fileInfo.Name.Replace("_t@", "@");
                    fileName = fileName.Substring(0, fileName.IndexOf(@"@"));
                    //Debugger.Log(fileName);
                    string dir = fileInfo.DirectoryName;
                    dir = dir.Substring(dir.IndexOf(@"Assets"));
                    string tposeFileName = string.Empty;
                    foreach (var file in fileInfo.Directory.GetFiles("*.FBX"))
                    {
                        if (!file.Name.Contains("@") && fileInfo.Name.Contains(fileName))
                        {
                            tposeFileName = file.Name;
                            break;
                        }
                    }
                    Debugger.Log(tposeFileName);
                    if (string.IsNullOrEmpty(tposeFileName))
                    {
                        return;
                    }
                    string fullName = dir + "\\" + tposeFileName;
                    fullName = fullName.Replace(Path.DirectorySeparatorChar, '/');
                    Debugger.Log(fullName);

                    GameObject model = AssetDatabase.LoadAssetAtPath <GameObject>(fullName);
                    if (model)
                    {
                        Animator animator = model.GetComponent <Animator>();
                        if (animator == null)
                        {
                            Debugger.LogError(string.Format("can not find animator from {0}", fullName));
                        }
                        else
                        {
                            Avatar avatar = animator.avatar;
                            //Debugger.Log(avatar == null);
                            modelImporter.sourceAvatar = avatar;
                        }
                    }
                    else
                    {
                        Debugger.LogError(string.Format("can not find model from {0}", fullName));
                    }


                    //if (path.Contains("@Idle") || path.Contains("@Run"))
                    //{
                    //    Debugger.Log(path + "  " + modelImporter.clipAnimations.Length + "   " + modelImporter.defaultClipAnimations.Length);
                    //    foreach (var c in modelImporter.clipAnimations)
                    //    {
                    //        //Debugger.Log(c.loopTime + "   " + c.loop);
                    //        c.wrapMode = WrapMode.Loop;
                    //        c.loopTime = true;
                    //        c.loop = true;
                    //        //Debugger.Log(c.loopTime + "   " + c.loop);
                    //    }
                    //}
                    //modelImporter.animationWrapMode = WrapMode.Loop;
                }
                Debugger.Log("import model:" + assetPath);
            }
            else if (path.Contains("Res/Resources/effects"))
            {
                modelImporter.animationType = ModelImporterAnimationType.None;
                //modelImporter.globalScale = 0.01f;
                if (!assetPath.Contains("@"))
                {
                    modelImporter.optimizeGameObjects = false;
                    modelImporter.optimizeMesh        = true;
                    modelImporter.importAnimation     = false;
                    modelImporter.importBlendShapes   = false;
                    modelImporter.isReadable          = false;
                    modelImporter.importMaterials     = false;
                    modelImporter.tangentImportMode   = ModelImporterTangentSpaceMode.None;
                    modelImporter.meshCompression     = ModelImporterMeshCompression.High;
                }
            }
            #endregion
            //#region shadow
            //if (path.Contains("shadow"))
            //{
            //    modelImporter.animationType = ModelImporterAnimationType.None;
            //    modelImporter.optimizeGameObjects = false;
            //    modelImporter.optimizeMesh = true;
            //    modelImporter.importAnimation = false;
            //    modelImporter.importMaterials = true;
            //}
            //#endregion
        }