示例#1
0
 public static void DebugPlayableGraph(this PlayableGraph playableGraph, string prefixString)
 {
     DLog.Log($"{prefixString}.isDone: {playableGraph.isDone}");
     DLog.Log($"{prefixString}.playableCount: {playableGraph.playableCount}");
     DLog.Log($"{prefixString}.rootPlayableCount: {playableGraph.rootPlayableCount}");
     DLog.Log($"{prefixString}.scriptOutputCount: {playableGraph.scriptOutputCount}");
 }
示例#2
0
            public virtual byte[] ReadAllBytes()
            {
                if (IsEncrypt)
                {
                    long pos = mStream.Position;
                    byte[] tbytes = ReadBytes((int)Length);
                    mStream.Seek(pos, SeekOrigin.Current);

                    byte[] ret = new byte[tbytes.Length - SafeByteLen];
                    System.Array.Copy(tbytes, 0, ret, 0, tbytes.Length - SafeByteLen);
                    return ret;
                }
                else
                {
                    if (mBuffer != null) return mBuffer;
                    byte[] ret = new byte[mStream.Length];

                    DLog.Log(mStream.Length);
                    long pos = mStream.Position;
                    mStream.Seek(0, SeekOrigin.Begin);
                    mStream.Read(ret, 0, (int)mStream.Length);
                    mStream.Seek(pos, SeekOrigin.Current);
                    return ret;
                }
                
            }
        private void HandleHotkeys()
        {
            Event e = Event.current;

            if (e.type == EventType.KeyDown)
            {
                /*if (e.control && e.keyCode == KeyCode.M)
                 * {
                 *      DungeonSpawnConfig.Config.DebugRects();SWSS
                 * }
                 *
                 * if (e.control && e.keyCode == KeyCode.N)
                 * {
                 *      debugged = true;
                 * }*/

                if (e.control && e.keyCode == KeyCode.S)
                {
                    ForceSave();
                }
            }

            if (debugged && e.type == EventType.Repaint)
            {
                debugged = false;
                Rect rect = GUILayoutUtility.GetLastRect();
                DLog.Log($"yMin: {rect.yMin} | yMax: {rect.yMax} | height: {rect.height}");
            }
        }
        public static void DebugMinMaxGradient(this ParticleSystem.MinMaxGradient minMaxGradient, string prefixString)
        {
            DLog.Log($"{prefixString}.color: {minMaxGradient.color}");
            DLog.Log($"{prefixString}.colorMax: {minMaxGradient.colorMax}");
            DLog.Log($"{prefixString}.colorMin: {minMaxGradient.colorMin}");

            if (minMaxGradient.gradient == null)
            {
                DLog.Log($"{prefixString}.gradient: NULL");
            }
            else
            {
                minMaxGradient.gradient.DebugGradient($"{prefixString}.gradient");
            }

            if (minMaxGradient.gradientMax == null)
            {
                DLog.Log($"{prefixString}.gradientMax: NULL");
            }
            else
            {
                minMaxGradient.gradientMax.DebugGradient($"{prefixString}.gradientMax");
            }

            if (minMaxGradient.gradientMin == null)
            {
                DLog.Log($"{prefixString}.gradientMin: NULL");
            }
            else
            {
                minMaxGradient.gradientMin.DebugGradient($"{prefixString}.gradientMin");
            }

            DLog.Log($"{prefixString}.mode: {minMaxGradient.mode}");
        }
    public virtual Node <Type> createNode(Node <Type> headNode, Type val)
    {
        if (headNode != null || head == null)
        {
            Node <Type> node = ((Transform)Instantiate(nodePrefab, Vector3.zero, Quaternion.identity)).GetComponent <Node <Type> > ();
            node.value = val;

            DLog.Log("Node " + val + " created.", Color.green);

            if (headNode != null)
            {
                headNode.addConnection(node, SearchConstants.WEIGHT_CONSTANT);
            }

            if (head == null)
            {
                head        = node;
                node.isHead = true;

                DLog.Log("Node " + val + " set to head.", Color.yellow);
            }

            DLog.Log("Assigned new depths: " + assignDepth(head, 0), Color.yellow);

            return(node);
        }

        return(null);
    }
示例#6
0
            virtual protected bool TCPConnect()
            {
                bool             ret   = false;
                List <IPAddress> tipds = GetServerIpAddress(mHostName);

                if (tipds.Count == 0)
                {
                    DLog.LogError("IPAddress List.Count = 0!");
                }

                foreach (IPAddress tip in tipds)
                {
                    try
                    {
                        DLog.Log(string.Format("[开始连接]" + " HostName:{0} IpAddress:{1} AddressFamily:{2}", mHostName, tip.ToString(), tip.AddressFamily.ToString()));
                        mSocket = new Socket(tip.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
                        ChoseSocketTimeOutAndBuffer();
                        mSocket.Connect(tip, mPort);
                        DLog.Log("连接成功!");
                        ret = true;
                        break;
                    }
                    catch (Exception e)
                    {
                        DLog.LogError(string.Format("[网络连接异常]" + " HostName:{0} IpAddress:{1} AddressFamily:{2} ErrorMessage:{3}", mHostName, tip.ToString(), tip.AddressFamily.ToString(), e.ToString()));
                    }
                }

                return(ret);
            }
示例#7
0
 public static void DebugAvatar(this Avatar avatar, string prefixString)
 {
     DLog.Log($"{prefixString}.hideFlags: {avatar.hideFlags}");
     DLog.Log($"{prefixString}.isHuman: {avatar.isHuman}");
     DLog.Log($"{prefixString}.isValid: {avatar.isValid}");
     DLog.Log($"{prefixString}.name: {avatar.name}");
 }
        public static void DebugTextGenerator(this TextGenerator textGenerator, string prefixString)
        {
            DLog.Log($"{prefixString}.characterCount: {textGenerator.characterCount}");
            DLog.Log($"{prefixString}.characterCountVisible: {textGenerator.characterCountVisible}");

            foreach (UICharInfo uICharInfo in textGenerator.characters)
            {
                uICharInfo.DebugUICharInfo($"{prefixString}.characters");
            }

            DLog.Log($"{prefixString}.fontSizeUsedForBestFit: {textGenerator.fontSizeUsedForBestFit}");
            DLog.Log($"{prefixString}.lineCount: {textGenerator.lineCount}");

            foreach (UILineInfo uILineInfo in textGenerator.lines)
            {
                uILineInfo.DebugUILineInfo($"{prefixString}.lines");
            }

            DLog.Log($"{prefixString}.rectExtents: {textGenerator.rectExtents}");
            DLog.Log($"{prefixString}.vertexCount: {textGenerator.vertexCount}");

            foreach (UIVertex uIVertex in textGenerator.verts)
            {
                uIVertex.DebugUIVertex($"{prefixString}.verts");
            }
        }
示例#9
0
        public static void DebugGameObject(this GameObject gameObject, string prefixString = null, bool debugChilds = false)
        {
            if (prefixString == null)
            {
                DLog.Log($"\n[GameObject] ({gameObject.name})");
                prefixString = "this";
            }

            DLog.Log($"{prefixString}.activeInHierarchy: {gameObject.activeInHierarchy}");
            DLog.Log($"{prefixString}.activeSelf: {gameObject.activeSelf}");
            DLog.Log($"{prefixString}.hideFlags: {gameObject.hideFlags}");
            DLog.Log($"{prefixString}.isStatic: {gameObject.isStatic}");
            DLog.Log($"{prefixString}.layer: {gameObject.layer}");
            DLog.Log($"{prefixString}.name: {gameObject.name}");
            gameObject.scene.DebugScene($"{prefixString}.scene");
            DLog.Log($"{prefixString}.tag: {gameObject.tag}");
            DLog.Log($"{prefixString}.transform: {gameObject.transform.name}");

            DLog.Log($"Components of this GameObject: {gameObject.name}");

            foreach (Component component in gameObject.GetComponents <Component>())
            {
                DLog.Log($"{prefixString}.{component.GetType()}");
            }

            if (debugChilds)
            {
                gameObject.DebugChildObjects();
            }
        }
示例#10
0
    //only the server should ever get this..
    //this should happen before fixedupdate was called for this frame.
    public void ReceiveInput(PhysicsInputCommand e)
    {
        //keep track of ALL inputs from ALL players (for rigidbody players)
        //we need this so we can apply their inputs and simulate that frame to validate it
        if (!playerInputs.ContainsKey(e.frame))
        {
            playerInputs.Add(e.frame, new List <PhysicsInputState>());
        }
        playerInputs[e.frame].Add(new PhysicsInputState()
        {
            onlineIndex = e.onlineIndex, inputDir = e.inputDir, dash = e.dash, frame = e.frame
        });


        if (playerInputs[e.frame] != null)
        {
            if (playerInputs[e.frame].Count == waitForPlayerInputs)  //we dynamically increase waitForPlayerInputs whenever a player connects.
                                                                     //If we do not and run the server physics step it never gets validated before
                                                                     //they connect, which means if they take 10,000 frames to connect,
                                                                     //validate tries to validate (and step) [0->10,000] which causes hangs.

            //we have all the inputs for this frame, validate it now!
            {
                DLog.Log("Received all inputs for frame: " + e.frame);
                t2.text = "Rec all inputs for frame " + e.frame;
                ValidatePhysics(e.frame);
            }
        }
    }
            public void OnGUI()
            {
                using (new EditorHelper.Horizontal())
                {
                    GUIStyle guiStyle = new GUIStyle(EditorStyles.label);
                    guiStyle.fontStyle = FontStyle.Bold;
                    EditorGUILayout.LabelField($"Min time: {totalTime}s", guiStyle, GUILayout.MaxWidth(150));
                    EditorGUILayout.LabelField($"Last update: {lastUpdate}", GUILayout.MaxWidth(250));

                    if (GUILayout.Button("Calculate Min Time"))
                    {
                        Process();
                    }

                    if (GUILayout.Button("Log", GUILayout.Width(50)))
                    {
                        for (int i = 0; i < waveMinTimes.Count; i++)
                        {
                            DLog.Log($"Wave {i+1}: {waveMinTimes[i]}s");
                        }

                        DLog.Log("-------------------");

                        foreach (KeyValuePair <int, float> pair in trackerMinWaitTimeByEventID)
                        {
                            DLog.Log($"EventID: {pair.Key} | Time: {pair.Value}s");
                        }

                        DLog.Log("-------------------");
                    }
                }
            }
示例#12
0
 virtual protected void DebugMsg(int _cmd, byte[] _buffer, int offset, int _len, string _title, bool pIsComplete = true)
 {
     if (IsShowDebugLog)
     {
         System.Text.StringBuilder bufferstr = new System.Text.StringBuilder();
         bufferstr.Append("{");
         for (int i = offset; i < _len; i++)
         {
             if (i != offset)
             {
                 bufferstr.Append(",");
             }
             bufferstr.Append(_buffer[i]);
         }
         bufferstr.Append("}");
         string tmsg = string.Format("{0}-cmd:{1} title:{2}  长度:{3}  内容:{4}", mNetTag, _cmd, _title, _len, bufferstr);
         if (pIsComplete)
         {
             DLog.Log(tmsg);
         }
         else
         {
             DLog.LOGColor(DLogType.Log, tmsg, LogColor.YELLO);
         }
     }
 }
示例#13
0
        public static void DoLogs(Object context)
        {
            // Examples of DLog.Log()
            DLog.Log("Log a message");
            DLog.Log("Log a message with a specific color", Color.blue);
            DLog.Log("Log a message with a user-defined color", new Color(0f, 0.5f, 0f));

            // Examples of DLog.LogWarning()
            DLog.LogWarning("Log a warning message");
            DLog.LogWarning("Log a warning message with a specific color", Color.yellow);
            DLog.LogWarning("Log a warning message with a user-defined color", new Color(1f, 0.5f, 0.25f));

            // Examples of DLog.LogError()
            DLog.LogError("Log an error message");
            DLog.LogError("Log an error message with a specific color", Color.red);
            DLog.LogError("Log an error message with a user-defined color", new Color(1f, 0f, 1f));

            // Examples of DLog.LogException()
            DLog.LogException(new System.Exception("Log an exception message"));
            DLog.LogException(new System.Exception("Log an exception message with a specific color"), Color.red);
            DLog.LogException(new System.Exception("Log an exception message with a user-defined color"), new Color(1f, 0f, 1f));

            // Examples of logging With Context
            DLog.Log("Log a message with a context", context);
            DLog.Log("Log a message with a specific color and context", Color.green, context);

            DLog.LogWarning("Log a warning message with a context", context);
            DLog.LogWarning("Log a warning message with a specific color and context", Color.cyan, context);

            DLog.LogError("Log an error message with a context", context);
            DLog.LogError("Log an error message with a specific color and context", Color.red, context);

            DLog.LogException(new System.Exception("Log an exception message with a context"), context);
            DLog.LogException(new System.Exception("Log an exception message with a specific color and context"), Color.red, context);
        }
示例#14
0
        protected List <IPAddress> GetServerIpAddress(string _hostname)
        {
            List <IPAddress> ret = new List <IPAddress>();

            try
            {
                IPAddress[] tips = Dns.GetHostEntry(mHostName).AddressList;
                DLog.Log("HostName: " + mHostName + " Length:" + tips.Length);
                for (int i = 0; i < tips.Length; i++)
                {
                    // DLog.Log( "IpAddress: " + tips[i].ToString() + " AddressFamily:" + tips[i].AddressFamily.ToString());

                    if (tips[i].AddressFamily == AddressFamily.InterNetwork)
                    {
                        ret.Insert(0, tips[i]);
                    }
                    else
                    {
                        ret.Add(tips[i]);
                    }
                }
            }
            catch (Exception e)
            {
                DLog.LogError(string.Format("[获取IPAddress失败]" + " HostName:{0} IP:{1} ErrorMessage:{2}", mHostName, ret.Count, e.ToString()));
            }
            return(ret);
        }
示例#15
0
    /// <summary>
    /// Initializes the static <see cref="MultiThreading"/> class.
    /// Start seperate abort thread, to handle when the application stops playing or is shutdown.
    /// Create MultiThreading obj of type static update, to act as main unity thread.
    /// </summary>
    static MultiThreading()
    {
        mainIsRunning = true;

        new MultiThreading();

        Thread abortThread = new Thread(() => {
            try{
                bool running = true;
                while (running)
                {
                    if (!mainIsRunning)
                    {
                        stopAll();
                        Thread.CurrentThread.Abort();
                        running = false;
                    }

                    Thread.Sleep(1000);
                }
            }catch (ThreadAbortException e) {
                DLog.Log("ABORTED THREAD ENDED", UnityEngine.Color.yellow);
            }
        }, 131072);

        abortThread.IsBackground = true;
        abortThread.Start();
    }
    public void ApplyServerInput(PhysicsInputState e)
    {
        DLog.Log(string.Format("ApplyingServerInput for player {1} - frame: {0}", e.frame, e.onlineIndex));
        Vector2 input = e.inputDir;

        r.AddForce(new Vector3(input.x, 0f, input.y) * moveSpeed);
    }
示例#17
0
 private void ReceiveMessage()
 {
     DLog.Log("TCP Start ReceiveMessage");
     try
     {
         while (mStartThread)
         {
             if (mSocket.Available != 0)
             {
                 int receiveNumber = 0;
                 receiveNumber = mSocket.Receive(mRecbuffer, 0, mReadMaxLen, SocketFlags.None);
                 if (receiveNumber > 0)
                 {
                     Processingdata(receiveNumber, mRecbuffer);
                 }
             }
         }
     }
     catch (Exception e)
     {
         if (mStartThread)
         {
             DLog.LogError(mNetTag + ":ReceiveMessage->" + e.ToString());
             CloseSRThread();
             AddMainThreadMsgReCall(GetMsgReCallData(MSG_RECALL.ReceiveError, mNetTag + "-" + e.ToString()));
         }
     }
     DLog.Log("TCP End ReceiveMessage");
 }
        public static void DebugAtlasSprite(this Atlas.Sprite sprite, string prefixString = null)
        {
            if (prefixString == null)
            {
                DLog.Log($"\n[Sprite]");
                prefixString = "this";
            }

            DLog.Log($"{prefixString}.border: {sprite.border}");
            DLog.Log($"{prefixString}.inner: {sprite.inner}");
            DLog.Log($"{prefixString}.outer: {sprite.outer}");
            DLog.Log($"{prefixString}.padding: {sprite.padding}");
            DLog.Log($"{prefixString}.pixelsPerUnit: {sprite.pixelsPerUnit}");
            DLog.Log($"{prefixString}.size: {sprite.size}");
            DLog.Log($"{prefixString}.slice9Grid: {sprite.slice9Grid}");

            sprite.texture.DebugTexture2D($"{prefixString}.texture");

            for (int i = 0; i < sprite.triangles.Length; i++)
            {
                DLog.Log($"{prefixString}.triangles[{i}]: {sprite.triangles[i]}");
            }

            for (int i = 0; i < sprite.uv0.Length; i++)
            {
                DLog.Log($"{prefixString}.uv0[{i}]: {sprite.uv0[i]}");
            }

            for (int i = 0; i < sprite.vertices.Length; i++)
            {
                DLog.Log($"{prefixString}.vertices[{i}]: {sprite.vertices[i]}");
            }
        }
 public static void DebugUILineInfo(this UILineInfo uILineInfo, string prefixString)
 {
     DLog.Log($"{prefixString}.height: {uILineInfo.height}");
     DLog.Log($"{prefixString}.leading: {uILineInfo.leading}");
     DLog.Log($"{prefixString}.startCharIdx: {uILineInfo.startCharIdx}");
     DLog.Log($"{prefixString}.topY: {uILineInfo.topY}");
 }
示例#20
0
        public static void DebugCanvas(this Canvas canvas, string prefixString = null)
        {
            if (prefixString == null)
            {
                DLog.Log($"\n[Canvas] ({canvas.name})");
                prefixString = "this";
            }

            DLog.Log($"{prefixString}.additionalShaderChannels: {canvas.additionalShaderChannels}");
            DLog.Log($"{prefixString}.cachedSortingLayerValue: {canvas.cachedSortingLayerValue}");
            DLog.Log($"{prefixString}.enabled: {canvas.enabled}");
            DLog.Log($"{prefixString}.gameObject: {canvas.gameObject.name}");
            DLog.Log($"{prefixString}.hideFlags: {canvas.hideFlags}");
            DLog.Log($"{prefixString}.isActiveAndEnabled: {canvas.isActiveAndEnabled}");
            DLog.Log($"{prefixString}.isRootCanvas: {canvas.isRootCanvas}");
            DLog.Log($"{prefixString}.name: {canvas.name}");
            DLog.Log($"{prefixString}.normalizedSortingGridSize: {canvas.normalizedSortingGridSize}");
            DLog.Log($"{prefixString}.overridePixelPerfect: {canvas.overridePixelPerfect}");
            DLog.Log($"{prefixString}.overrideSorting: {canvas.overrideSorting}");
            DLog.Log($"{prefixString}.pixelPerfect: {canvas.pixelPerfect}");
            DLog.Log($"{prefixString}.pixelRect: {canvas.pixelRect}");
            DLog.Log($"{prefixString}.planeDistance: {canvas.planeDistance}");
            DLog.Log($"{prefixString}.referencePixelsPerUnit: {canvas.referencePixelsPerUnit}");
            DLog.Log($"{prefixString}.renderMode: {canvas.renderMode}");
            DLog.Log($"{prefixString}.renderOrder: {canvas.renderOrder}");
            DLog.Log($"{prefixString}.rootCanvas: {canvas.rootCanvas.name}");
            DLog.Log($"{prefixString}.scaleFactor: {canvas.scaleFactor}");
            DLog.Log($"{prefixString}.sortingLayerID: {canvas.sortingLayerID}");
            DLog.Log($"{prefixString}.sortingLayerName: {canvas.sortingLayerName}");
            DLog.Log($"{prefixString}.sortingOrder: {canvas.sortingOrder}");
            DLog.Log($"{prefixString}.tag: {canvas.tag}");
            DLog.Log($"{prefixString}.targetDisplay: {canvas.targetDisplay}");
            DLog.Log($"{prefixString}.transform: {canvas.transform.name}");
            canvas.worldCamera.DebugCamera($"{prefixString}.worldCamera");
        }
示例#21
0
 public static void SortOutputHandler(object sendingProcess, System.Diagnostics.DataReceivedEventArgs outLine)
 {
     DLog.Log(outLine.Data);
     // Collect the sort command output.
     if (!string.IsNullOrEmpty(outLine.Data))
     {
     }
 }
示例#22
0
 public void PollPhysicsInputs(int frame)
 {
     DLog.Log("PM::PollPhysicsInputs(" + frame + ")");
     for (int i = 0; i < rewindables.Count; i++)
     {
         rewindables[i].GetComponent <NetworkedBubbleControllerBehaviour>().PollPhysicsInputs(frame); // <--- BAD!!!!!!!!!!!!! But ok for now ᕕ( ᐛ )ᕗ
     }
 }
示例#23
0
 public static void DebugKeyFrame(this Keyframe keyframe, string prefixString)
 {
     DLog.Log($"{prefixString}.inTangent: {keyframe.inTangent}");
     DLog.Log($"{prefixString}.outTangent: {keyframe.outTangent}");
     DLog.Log($"{prefixString}.tangentMode: {keyframe.tangentMode}");
     DLog.Log($"{prefixString}.time: {keyframe.time}");
     DLog.Log($"{prefixString}.value: {keyframe.value}");
 }
示例#24
0
 public static void ChangeState <T>(System.Action _complete, params object[] _objects) where T : StateBase, new()
 {
     Instance.completeDelegate = _complete;
     Instance.NextState        = new T();
     Instance.NextState.SetStateData(_objects);
     Instance.SelfAction = MAction.kst_change;
     DLog.Log("Change State to " + Instance.NextState.GetType().Name);
 }
示例#25
0
        public void StopListening()
        {
            listen = false;

            CTS.Cancel();

            DLog.Log("Listening Closed");
        }
 public static void DebugRects()
 {
     DLog.Log($"Scroll Position: {scrollPosition} - Window Height: {windowHeight}");
     foreach (KeyValuePair <int, Rect> pair in entryRects)
     {
         DLog.Log($"UID: {pair.Key} - yMin: {pair.Value.yMin} | yMax: {pair.Value.yMax} | height: {pair.Value.height}");
     }
 }
    public void ApplyLocalInput(PhysicsInputCommand e)
    {
        //here we apply commands as we generate them, while they're in trasit to the server for validation.
        //doing this gives us LOCAL PREDICTION
        DLog.Log(string.Format("Applying local input {1} - frame: {0}", e.frame, e.onlineIndex));
        Vector2 input = e.inputDir;

        r.AddForce(new Vector3(input.x, 0f, input.y) * moveSpeed);
    }
示例#28
0
 void Start()
 {
     DLog.Log("PhysicsManager Initialized");
     Physics.autoSimulation = false;
     //if(BoltNetwork.isClient) {
     //    simMode = PhysicsSimulationMode.NoSimulate;
     //}
     DLog.LogF("{0}:{1} words {2}", 1, 2, 3);
 }
 public static void DebugAnimatorControllerParameter(this AnimatorControllerParameter animatorControllerParameter, string prefixString)
 {
     DLog.Log($"{prefixString}.defaultBool: {animatorControllerParameter.defaultBool}");
     DLog.Log($"{prefixString}.defaultFloat: {animatorControllerParameter.defaultFloat}");
     DLog.Log($"{prefixString}.defaultInt: {animatorControllerParameter.defaultInt}");
     DLog.Log($"{prefixString}.name: {animatorControllerParameter.name}");
     DLog.Log($"{prefixString}.nameHash: {animatorControllerParameter.nameHash}");
     DLog.Log($"{prefixString}.type: {animatorControllerParameter.type}");
 }
示例#30
0
 public static void DebugScene(this Scene scene, string prefixString)
 {
     DLog.Log($"{prefixString}.buildIndex: {scene.buildIndex}");
     DLog.Log($"{prefixString}.isDirty: {scene.isDirty}");
     DLog.Log($"{prefixString}.isLoaded: {scene.isLoaded}");
     DLog.Log($"{prefixString}.name: {scene.name}");
     DLog.Log($"{prefixString}.path: {scene.path}");
     DLog.Log($"{prefixString}.rootCount: {scene.rootCount}");
 }