/// <summary> /// Change the axisranges for the world bounds to a new bounds. /// </summary> public static void EstablishMinBitsPerAxis(Bounds bounds, bool silent = false) { NSTSettings nstSettings = NSTSettings.EnsureExistsInScene(NSTSettings.DEFAULT_GO_NAME); DebugX.LogWarning(!DebugX.logWarnings ? "" : ("<b>Scene is missing map bounds</b>, defaulting to a map size of Center:" + NSTMapBounds.CombinedWorldBounds.center + " Size:" + NSTMapBounds.CombinedWorldBounds.size + ". Be sure to add NSTMapBounds components to your scene to define its bounds, or be sure the default bounds in NSTSettings are what you want."), (!silent && Application.isPlaying && (!NSTMapBounds.isInitialized || NSTMapBounds.ActiveBoundsCount == 0) && Time.time > 1) ); DebugX.LogWarning(!DebugX.logWarnings ? "" : ("<b>Scene map bounds are very small</b>. Current world bounds are " + bounds.center + " Size:" + bounds.size + ", is this intentional?" + "If not check that your NSTMapBounds fully encompass your world as intended, or if using the Default bounds set in NSTSettings, that it is correct."), (!silent && Application.isPlaying && (!NSTMapBounds.isInitialized || NSTMapBounds.ActiveBoundsCount > 0) && (bounds.size.x <= 1 || bounds.size.y <= 1 || bounds.size.z <= 1)) ); for (int axis = 0; axis < 3; axis++) { axisRanges[axis].ChangeRange(bounds.min[axis], bounds.max[axis], (nstSettings != null) ? nstSettings.minPosResolution : 100); } DebugX.Log( ("Notice: Change in Map Bounds (Due to an NSTBounds being added or removed from the scene) to \n" + "Center:" + bounds.center + " Size:" + bounds.size + ". Be sure this map change is happening to all networked clients or things will break badly. \n" + "Position keyframes will use x:" + axisRanges[0].bits + " bits, y:" + axisRanges[1].bits + "bits, and z:" + axisRanges[2].bits + " bits at the current minimum resolutons settings (in NST Settings)."), !silent && Application.isPlaying, true); }
public void OnStartInterpolate(Frame frame, bool lateArrival = false, bool midTeleport = false) { // Don't apply the transform for frame offtick updates. Those are for teleports and weapon fire. //TODO: Likely no longer needed, frame 0 shoud only fire onrcv //if (frame.frameid == 0)// && !frame.updateType.IsTeleport()) // return; for (int eid = 0; eid < elementCount; ++eid) { TransformElement te = transformElements[eid]; if (!cache_elementIsEnabled[eid]) { continue; } // Don't overwrite mid interpolation if this is a teleport override element, and we are mid teleport. if (lateArrival && midTeleport && te.teleportOverride) { continue; } // Don't modify elements with late arriving data if it is null. if (lateArrival && te.frames[frame.frameid].xform.type == XType.NULL) { DebugX.Log(!DebugX.logInfo ? null : (Time.time + " <b>Null Late Arrival - NOTE if you keep seeing this davin - remove this test otherwise </b> " + te.snapshotFrameId + " " + te.targetFrameId)); continue; } te.Snapshot(frame, lateArrival, midTeleport); } }
/// <summary> /// Overwrites the Adapter.CS files with the selected library specific version. /// </summary> /// <param name="newLib"></param> /// <returns>Returns true if successful.</returns> private static bool CopyUncompiledAdapters(NetworkLibrary newLib) // string libSuffix) { bool success = false; string libSuffix = (newLib == NetworkLibrary.UNET) ? "UNET" : "PUN"; var _MA = GetPathFromAssetName("MasterNetAdapter" + libSuffix); var _NA = GetPathFromAssetName("NSTNetAdapter" + libSuffix); var MA = GetPathFromAssetName("MasterNetAdapter"); var NA = GetPathFromAssetName("NSTNetAdapter"); // fail if any of these files were not found. if (_MA == "" || _NA == "" || MA == "" || NA == "") { return(false); } DebugX.Log("Switching to " + libSuffix + " adapters... recompiling should happen automatically.", true, true); if (MasterNetAdapter.NetworkLibrary != newLib) { success |= AssetDatabase.CopyAsset(_MA, MA); } if (NSTNetAdapter.NetLibrary != newLib) { success |= AssetDatabase.CopyAsset(_NA, NA); } return(success); }
public void writeCompressString(String s) { if (s != null) { String compress; try { compress = GZipStrUtil.CompressString(s); } catch (IOException e) { DebugX.Log("dara writeCompressString ~" + e); compress = s; Debug.LogException(e); } if (s.Length > compress.Length) { Debug.Log(1.0f * compress.Length / s.Length + GZipStrUtil.DecompressString(compress)); // 压缩了 this.writeInt(1); this.writeString(compress); } else { // 没有压缩 this.writeInt(0); this.writeString(s); } } else { this.writeInt(0); this.writeInt(0); } }
/// <summary> /// 进入当前状态; /// </summary> public virtual void awaken() { if (IsDebug) { DebugX.Log("awaken:" + type); } }
/// <summary> /// Start the WWCP importer. /// </summary> public WWCPImporter <T> Start() { if (Monitor.TryEnter(UpdateEVSEDataAndStatusLock)) { try { if (!Started) { OnFirstRun(this, DownloadData(DateTime.Now, "1", _DNSClient)); DebugX.Log("WWCP importer '" + Id + "' Initital import finished!"); UpdateEVSEStatusTimer.Change(TimeSpan.FromSeconds(1), UpdateEvery); Started = true; } } catch (Exception e) { DebugX.Log("Starting the WWCP Importer '" + Id + "' led to an exception: " + e.Message + Environment.NewLine + e.StackTrace); } finally { Monitor.Exit(UpdateEVSEDataAndStatusLock); } } SaveForwardingDataToFile(); return(this); }
public override void Initialize() { single = this; base.Initialize(); if (initialized) { return; } initialized = true; // populate the lookup dictionary for (int i = 0; i < hitGroupTags.Count; i++) { if (rewindLayerTagToId.ContainsKey(hitGroupTags[i])) { DebugX.LogError(!DebugX.logErrors ? null : ("The tag '" + hitGroupTags[i] + "' is used more than once in NSTRewindSettings. Repeats will be discarded, which will likely break some parts of rewind until they are removed.")); } else { rewindLayerTagToId.Add(hitGroupTags[i], i); } } DebugX.Log(!DebugX.logInfo ? null : ("Initialized HitGroupMasterSettings - Total Layer Tags Count: " + hitGroupTags.Count)); }
private void Start() { DebugX.Log(@"I:orange:b; love:red:b; Unity:yellow:b; ColorfullllllllllllllllText:rainbow:b;"); DebugX.Log(@"sniper:orange:b; bug:green:b;"); }
/// <summary> /// Copy one frame to another. Used when the buffer is empty and either need to copy the current frame or resort to the offtick frame. /// </summary> public void CopyFrame(Frame sourceFrame, Frame targetFrame, bool includePositions = true, bool includeRotations = true) { targetFrame.pos = sourceFrame.pos; targetFrame.compPos = sourceFrame.compPos; targetFrame.endTime = sourceFrame.endTime; targetFrame.appliedTime = sourceFrame.appliedTime; // Strip the custom message flag from copies, or they will fire twice. targetFrame.msgType = (sourceFrame.msgType == MsgType.Cust_Msg) ? MsgType.Position : sourceFrame.msgType; if (includePositions) { targetFrame.positionsMask = sourceFrame.positionsMask; for (int i = 0; i < targetFrame.positions.Count; i++) { GenericX.Copy(sourceFrame.positions[i], targetFrame.positions[i]); DebugX.Log(Time.time + " " + i + " Copy Source Pos " + sourceFrame.positions[i]); } } if (includeRotations) { targetFrame.rotationsMask = sourceFrame.rotationsMask; for (int i = 0; i < targetFrame.rotations.Count; i++) { GenericX.Copy(sourceFrame.rotations[i], targetFrame.rotations[i]); DebugX.Log(Time.time + " " + i + " Copy Source Rot " + sourceFrame.rotations[i]); } } targetFrame.packetArriveTime = Time.time; }
public void OnStartInterpolate(Frame frame, bool lateArrival = false, bool midTeleport = false) { // Don't apply the transform for frame 0 updates. Those are for teleports and weapon fire. if (frame.frameid == 0) // && !frame.updateType.IsTeleport()) { return; } for (int eid = 0; eid < transformElements.Length; eid++) { TransformElement te = transformElements[eid]; // Don't overwrite mid interpolation if this is a teleport override element, and we are mid teleport. if (lateArrival && midTeleport && te.teleportOverride) { continue; } // Don't modify elements with late arriving data if it is null. if (lateArrival && frame.elements[eid].transform.type == XType.NULL) { DebugX.Log(!DebugX.logInfo ? "" : (Time.time + " <b>Null Late Arrival - NOTE if you keep seeing this davin - remove this test otherwise </b> " + te.snapshot + " " + te.target)); continue; } te.Snapshot(frame, lateArrival, midTeleport); } }
/// <summary> /// Notify that an HTTP error occured. /// </summary> /// <param name="Timestamp">The timestamp of the error received.</param> /// <param name="Sender">The sender of this error message.</param> /// <param name="SOAPXML">The SOAP fault/error.</param> protected void SendSOAPError(DateTime Timestamp, Object Sender, XElement SOAPXML) { DebugX.Log("AOICPUpstreamService => SOAP Fault: " + SOAPXML != null ? SOAPXML.ToString() : "<null>"); OnSOAPError?.Invoke(Timestamp, Sender, SOAPXML); }
/// <summary> /// Notify that an exception occured. /// </summary> /// <param name="Timestamp">The timestamp of the exception.</param> /// <param name="Sender">The sender of this exception.</param> /// <param name="Exception">The exception itself.</param> protected void SendException(DateTime Timestamp, Object Sender, Exception Exception) { DebugX.Log("AOICPUpstreamService => Exception: " + Exception.Message); OnException?.Invoke(Timestamp, Sender, Exception); }
/// <summary> /// Notify that an HTTP error occured. /// </summary> /// <param name="Timestamp">The timestamp of the error received.</param> /// <param name="Sender">The sender of this error message.</param> /// <param name="HttpResponse">The HTTP response related to this error message.</param> protected void SendHTTPError(DateTime Timestamp, Object Sender, HTTPResponse HttpResponse) { DebugX.Log("AOICPUpstreamService => HTTP Status Code: " + HttpResponse != null ? HttpResponse.HTTPStatusCode.ToString() : "<null>"); OnHTTPError?.Invoke(Timestamp, Sender, HttpResponse); }
/// <summary> /// Notify that a JSON error occured. /// </summary> /// <param name="Timestamp">The timestamp of the error received.</param> /// <param name="Sender">The sender of this error message.</param> /// <param name="JSON">The JSON fault/error.</param> protected void SendJSONError(DateTime Timestamp, Object Sender, JObject JSON) { DebugX.Log("AOICPUpstreamService => JSON Fault: " + JSON != null ? JSON.ToString() : "<null>"); OnJSONError?.Invoke(Timestamp, Sender, JSON); }
public virtual void sleep() { if (IsDebug) { DebugX.Log("sleep:" + type); } this.simpleDispatch(EventX.EXIT); }
private void Cash() { mCash = true; switch (renderType) { case RenderType.Material: mR = transform.GetComponent <Renderer>(); if (mR != null) { mMat = mR.material; } else { DebugX.Log(transform.name + "物体 Material == null"); enabled = false; } break; case RenderType.ShaderColor: mR = transform.GetComponent <Renderer>(); if (mR != null) { mMat = mR.material; if (mMat.HasProperty(shaderColorName)) { break; } DebugX.Log(transform.name + "物体 Material.HasProperty(" + shaderColorName + ") == false"); break; } DebugX.Log(transform.name + "物体 Material == null"); enabled = false; break; case RenderType.SpriteRenderer: mSpR = transform.GetComponent <SpriteRenderer>(); if (mSpR == null) { DebugX.Log(transform.name + "物体 SpriteRenderer == null"); enabled = false; } break; case RenderType.MeshColor: MeshFilter mMesR = transform.GetComponent <MeshFilter>(); if (mMesR == null) { mMesh = mMesR.mesh; DebugX.Log(transform.name + "物体 Mesh == null"); enabled = false; } break; default: break; } }
private void OnDisable() { DebugX.Log("Factoring Out MapBound for now disabled \"" + name + "\""); if (factorBoundsOn == FactorBoundsOn.EnableDisable) { FactorInBounds(false); } }
private void OnEnable() { DebugX.Log("Factoring In MapBound for \"" + name + "\""); if (factorBoundsOn == FactorBoundsOn.EnableDisable) { FactorInBounds(true); } }
private void OnDownButton() { isManipulation = false; BumUITool.SetActionTrue(mainPage.adjustButton.gameObject); BumUITool.SetActionTrue(mainPage.hideButton.gameObject); BumUITool.SetActionFalse(mainPage.downButton.gameObject); BumUITool.SetActionFalse(mainPage.cancelButton.gameObject); DebugX.Log("OnDownButton"); }
private void RegisterURITemplates() { #region PUT ~/* // curl -X PUT http://127.0.0.1:9901/diagnostics/test.log -T test.log HTTPServer.AddMethodCallback(HTTPHostname.Any, HTTPMethod.PUT, URLPathPrefix + "{file}", HTTPDelegate: async Request => { try { var filepath = Request.Path.ToString().Replace("..", ""); var filename = filepath.Substring(filepath.LastIndexOf("/") + 1); var file = File.Create(filename); var data = Request.HTTPBody; await file.WriteAsync(data, 0, data.Length); DebugX.Log("UploadAPI: Received file '" + filename + "'!"); return new HTTPResponse.Builder(Request) { HTTPStatusCode = HTTPStatusCode.Created, Server = DefaultHTTPServerName, Date = Timestamp.Now, AccessControlAllowOrigin = "*", AccessControlAllowMethods = "PUT", Connection = "close" }; } catch (Exception e) { DebugX.Log("UploadAPI: Could not received file: " + e.Message); return new HTTPResponse.Builder(Request) { HTTPStatusCode = HTTPStatusCode.InternalServerError, Server = DefaultHTTPServerName, Date = Timestamp.Now, AccessControlAllowOrigin = "*", AccessControlAllowMethods = "PUT", ContentType = HTTPContentType.TEXT_UTF8, Content = e.Message.ToUTF8Bytes(), Connection = "close" }; } }); #endregion }
private void OnDestroy() { DebugX.Log("Factoring out MapBound for now destroyed \"" + name + "\""); if (factorBoundsOn == FactorBoundsOn.AwakeDestroy) { FactorInBounds(false); } }
public void AddOrUpdateEVSE(EVSEDataRecord CurrentEVSEDataRecord) { if (!_EVSEs.ContainsKey(CurrentEVSEDataRecord.Id)) { _EVSEs.Add(CurrentEVSEDataRecord.Id, CurrentEVSEDataRecord); } else { DebugX.Log("Duplicate EVSE identification: '" + CurrentEVSEDataRecord.Id + "'!"); } }
public void ApplyDamage(float dmg, int hitGroupMask = 0) { if (!na.IsServer) { return; } if (dmg == 0) { return; } float modifiedDmg = ModifyDamageForHitGroup(dmg, hitGroupMask); DebugX.Log(!DebugX.logInfo ? "" : (Time.time + " Apply Dmg: " + dmg + " Modified Dmg: " + modifiedDmg + " hitgroup mask:" + BitTools.PrintBitMask((uint)hitGroupMask))); lastDamageTakenTime = Time.time; // Subtract damage. Start with highest index and pass mitigated damage down for (int i = vitals.Count - 1; i >= 0; i--) { float mitigatedDmg = modifiedDmg * vitals[i].absorbtion; // mitigated damage exceeds the entirety of this vital - take all of it. if (mitigatedDmg > vitals[i].Value) { modifiedDmg -= vitals[i].Value; vitals[i].Value = 0; } else { modifiedDmg -= mitigatedDmg; vitals[i].Value -= mitigatedDmg; // no more damage to recurse to next lower vital - we are done if (modifiedDmg == 0) { break; } } } // Kill NST if health drops to zero if (vitals[0].Value <= 0) { nst.State = State.Dead; } UpdateMonitors(); //ReportHealth(dmg, hitGroupMask); }
/// <summary> /// Notify that an HTTP error occured. /// </summary> /// <param name="Timestamp">The timestamp of the error received.</param> /// <param name="Sender">The sender of this error message.</param> /// <param name="HttpResponse">The HTTP response related to this error message.</param> protected void SendHTTPError(DateTime Timestamp, Object Sender, HTTPResponse HttpResponse) { DebugX.Log("AOICPUpstreamService => HTTP Status Code: " + HttpResponse != null ? HttpResponse.HTTPStatusCode.ToString() : "<null>"); var OnHTTPErrorLocal = OnHTTPError; if (OnHTTPErrorLocal != null) { OnHTTPErrorLocal(Timestamp, Sender, HttpResponse); } }
private void OnAdjustButton() { //BumUITool.SetActionFalse(mainPage.adjustButton.gameObject); //BumUITool.SetActionTrue(mainPage.downButton.gameObject); //BumUITool.SetActionTrue(mainPage.adjustConfirm.gameObject); //BumUITool.SetActionFalse(mainPage.AdjustPlane.gameObject); BumUITool.SetActionFalse(mainPage.adjustButton.gameObject); BumUITool.SetActionFalse(mainPage.hideButton.gameObject); BumUITool.SetActionTrue(mainPage.downButton.gameObject); BumUITool.SetActionTrue(mainPage.cancelButton.gameObject); isManipulation = true; DebugX.Log("OnAdjustButton"); }
/// <summary> /// Notify that an HTTP error occured. /// </summary> /// <param name="Timestamp">The timestamp of the error received.</param> /// <param name="Sender">The sender of this error message.</param> /// <param name="SOAPXML">The SOAP fault/error.</param> protected void SendSOAPError(DateTime Timestamp, Object Sender, XElement SOAPXML) { DebugX.Log("AOICPUpstreamService => SOAP Fault: " + SOAPXML != null ? SOAPXML.ToString() : "<null>"); var OnSOAPErrorLocal = OnSOAPError; if (OnSOAPErrorLocal != null) { OnSOAPErrorLocal(Timestamp, Sender, SOAPXML); } }
/// <summary> /// Notify that an exception occured. /// </summary> /// <param name="Timestamp">The timestamp of the exception.</param> /// <param name="Sender">The sender of this exception.</param> /// <param name="Exception">The exception itself.</param> protected void SendException(DateTime Timestamp, Object Sender, Exception Exception) { DebugX.Log("AOICPUpstreamService => Exception: " + Exception.Message); var OnExceptionLocal = OnException; if (OnExceptionLocal != null) { OnExceptionLocal(Timestamp, Sender, Exception); } }
internal T[] AllocateRaw(int size) { var item = TryAllocate(size); if (item == null) { DebugX.Log($"DynamicSizeArrayPool new Array({size})"); return(new T[size]); } else { return(item); } }
/// <summary> /// 清理 /// </summary> public virtual void clear(bool triggerZoom = true) { DebugX.Log("BaseRectTriggerManager clear"); foreach (var trigger in _currentInRects) { if (triggerZoom) { onTrigger(trigger, false); } } _currentInRects.Clear(); _rectList.Clear(); }
/// <summary> /// Deep find and add of adapters to all NSTs objects in assets. Deferred actions that need to happen after a compile following library change. /// </summary> public static void TryToAddDependenciesEverywhere() { if (DependenciesHaveBeenAddedEverywhere) { return; } DebugX.Log("Adding NST Entities in all Assets"); MasterNetAdapter.AddNstEntityComponentsEverywhere(); // Now that prefabs in assets have been altered, make sure any scene objects revert to those prefabs RevertPrefabsInSceneWithComponentType <NetworkSyncTransform>(); DependenciesHaveBeenAddedEverywhere = true; }