Archived
添加一些单例系统,材质方法
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 51 KiB |
@@ -1,98 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 95b707722850450448c118a4c2f6f18e
|
|
||||||
TextureImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 11
|
|
||||||
mipmaps:
|
|
||||||
mipMapMode: 0
|
|
||||||
enableMipMap: 1
|
|
||||||
sRGBTexture: 1
|
|
||||||
linearTexture: 0
|
|
||||||
fadeOut: 0
|
|
||||||
borderMipMap: 0
|
|
||||||
mipMapsPreserveCoverage: 0
|
|
||||||
alphaTestReferenceValue: 0.5
|
|
||||||
mipMapFadeDistanceStart: 1
|
|
||||||
mipMapFadeDistanceEnd: 3
|
|
||||||
bumpmap:
|
|
||||||
convertToNormalMap: 0
|
|
||||||
externalNormalMap: 0
|
|
||||||
heightScale: 0.25
|
|
||||||
normalMapFilter: 0
|
|
||||||
isReadable: 0
|
|
||||||
streamingMipmaps: 0
|
|
||||||
streamingMipmapsPriority: 0
|
|
||||||
vTOnly: 0
|
|
||||||
ignoreMasterTextureLimit: 0
|
|
||||||
grayScaleToAlpha: 0
|
|
||||||
generateCubemap: 6
|
|
||||||
cubemapConvolution: 0
|
|
||||||
seamlessCubemap: 0
|
|
||||||
textureFormat: 1
|
|
||||||
maxTextureSize: 2048
|
|
||||||
textureSettings:
|
|
||||||
serializedVersion: 2
|
|
||||||
filterMode: 1
|
|
||||||
aniso: 1
|
|
||||||
mipBias: 0
|
|
||||||
wrapU: 0
|
|
||||||
wrapV: 0
|
|
||||||
wrapW: 0
|
|
||||||
nPOTScale: 1
|
|
||||||
lightmap: 0
|
|
||||||
compressionQuality: 50
|
|
||||||
spriteMode: 0
|
|
||||||
spriteExtrude: 1
|
|
||||||
spriteMeshType: 1
|
|
||||||
alignment: 0
|
|
||||||
spritePivot: {x: 0.5, y: 0.5}
|
|
||||||
spritePixelsToUnits: 100
|
|
||||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
|
||||||
spriteGenerateFallbackPhysicsShape: 1
|
|
||||||
alphaUsage: 1
|
|
||||||
alphaIsTransparency: 0
|
|
||||||
spriteTessellationDetail: -1
|
|
||||||
textureType: 0
|
|
||||||
textureShape: 1
|
|
||||||
singleChannelComponent: 0
|
|
||||||
flipbookRows: 1
|
|
||||||
flipbookColumns: 1
|
|
||||||
maxTextureSizeSet: 0
|
|
||||||
compressionQualitySet: 0
|
|
||||||
textureFormatSet: 0
|
|
||||||
ignorePngGamma: 0
|
|
||||||
applyGammaDecoding: 0
|
|
||||||
platformSettings:
|
|
||||||
- serializedVersion: 3
|
|
||||||
buildTarget: DefaultTexturePlatform
|
|
||||||
maxTextureSize: 2048
|
|
||||||
resizeAlgorithm: 0
|
|
||||||
textureFormat: -1
|
|
||||||
textureCompression: 1
|
|
||||||
compressionQuality: 50
|
|
||||||
crunchedCompression: 0
|
|
||||||
allowsAlphaSplitting: 0
|
|
||||||
overridden: 0
|
|
||||||
androidETC2FallbackOverride: 0
|
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
||||||
spriteSheet:
|
|
||||||
serializedVersion: 2
|
|
||||||
sprites: []
|
|
||||||
outline: []
|
|
||||||
physicsShape: []
|
|
||||||
bones: []
|
|
||||||
spriteID:
|
|
||||||
internalID: 0
|
|
||||||
vertices: []
|
|
||||||
indices:
|
|
||||||
edges: []
|
|
||||||
weights: []
|
|
||||||
secondaryTextures: []
|
|
||||||
nameFileIdTable: {}
|
|
||||||
spritePackingTag:
|
|
||||||
pSDRemoveMatte: 0
|
|
||||||
pSDShowRemoveMatteOption: 0
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,229 +1,24 @@
|
|||||||
# Package Starter Kit
|
# Xeric方法库
|
||||||
|
|
||||||
The purpose of this starter kit is to provide the data structure and development guidelines for new packages meant for the **Unity Package Manager (UPM)**.
|
提供一些快捷方法。
|
||||||
|
|
||||||
## Are you ready to become a package?
|
#### 版本
|
||||||
The Package Manager is a work in progress for Unity. Because of that, your package needs to meet these criteria to become an official Unity package:
|
|
||||||
- **Your code accesses public Unity C# APIs only.**
|
|
||||||
- **Your code doesn't require security, obfuscation, or conditional access control.**
|
|
||||||
|
|
||||||
|
|
||||||
## Package structure
|
* 0.2.1
|
||||||
|
修改:事件扩展 InvokeConservative 从ExtendType类中移到了MacroEvent
|
||||||
|
|
||||||
```none
|
* 0.1.1
|
||||||
<root>
|
添加对象宏:组件查找,关系判断
|
||||||
├── package.json
|
添加事件宏:事件调用
|
||||||
├── README.md
|
添加数学宏:值循环与类型扩展
|
||||||
├── CHANGELOG.md
|
添加枚举宏:枚举扩展
|
||||||
├── Third Party Notices.md
|
添加字符宏:字符功能扩展
|
||||||
├── Editor
|
移植弱类型:用于统一类型的判断,提供编号功能
|
||||||
│ ├── Lrss3.XericLibrary.Editor.asmdef
|
移植特性宏:重命名
|
||||||
│ └── EditorExample.cs
|
|
||||||
├── Runtime
|
|
||||||
│ ├── Lrss3.XericLibrary.asmdef
|
|
||||||
│ └── RuntimeExample.cs
|
|
||||||
├── Tests
|
|
||||||
│ ├── .tests.json
|
|
||||||
│ ├── Editor
|
|
||||||
│ │ ├── Lrss3.XericLibrary.Editor.Tests.asmdef
|
|
||||||
│ │ └── EditorExampleTest.cs
|
|
||||||
│ └── Runtime
|
|
||||||
│ ├── Lrss3.XericLibrary.Tests.asmdef
|
|
||||||
│ └── RuntimeExampleTest.cs
|
|
||||||
├── Samples
|
|
||||||
│ └── Example
|
|
||||||
│ ├── .sample.json
|
|
||||||
│ └── SampleExample.cs
|
|
||||||
└── Documentation
|
|
||||||
├── Xeric Library.md
|
|
||||||
└── Images
|
|
||||||
```
|
|
||||||
|
|
||||||
## Develop your package
|
* 0.1.0
|
||||||
Package development works best within the Unity Editor. Here's how to get started:
|
建立一些快捷的数学宏,数学算法,数学常数;
|
||||||
|
|
||||||
1. Enter your package name. The name you choose should contain your default organization followed by the name you typed. For example: `Lrss3.XericLibrary`.
|
|
||||||
|
|
||||||
2. [Enter the information](#FillOutFields) for your package in the `package.json` file.
|
|
||||||
|
|
||||||
3. [Rename and update](#Asmdef) assembly definition files.
|
|
||||||
|
|
||||||
4. [Document](#Doc) your package.
|
|
||||||
|
|
||||||
5. [Add samples](#Populate) to your package (code & assets).
|
|
||||||
|
|
||||||
6. [Validate](#Valid) your package.
|
|
||||||
|
|
||||||
7. [Add tests](#Tests) to your package.
|
|
||||||
|
|
||||||
8. Update the `CHANGELOG.md` file.
|
|
||||||
|
|
||||||
Every new feature or bug fix should have a trace in this file. For more details on the chosen changelog format, see [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
|
|
||||||
|
|
||||||
9. Make sure your package [meets all legal requirements](#Legal).
|
|
||||||
|
|
||||||
10. Publish your package.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="FillOutFields"></a>
|
|
||||||
### Completing the package manifest
|
|
||||||
|
|
||||||
You can either modify the package manifest (`package.json`) file directly in the Inspector or by using an external editor.
|
|
||||||
|
|
||||||
To use the Inspector, select the `package.json` file in the Project browser. The **Package Xeric Library Manifest** page opens for editing.
|
|
||||||
|
|
||||||
Update these required attributes in the `package.json` file:
|
|
||||||
|
|
||||||
| **Attribute name:** | **Description:** |
|
|
||||||
| ------------------- | ------------------------------------------------------------ |
|
|
||||||
| **name** | The officially registered package name. This name must conform to the [Unity Package Manager naming convention](https://docs.unity3d.com/Manual/upm-manifestPkg.html#name), which uses reverse domain name notation. For example: <br />`"com.[YourCompanyName].[your-package-name]"` |
|
|
||||||
| **displayName** | A user-friendly name to appear in the Unity Editor (for example, in the Project Browser, the Package Manager window, etc.). For example: <br />`"Terrain Builder SDK"` <br/>__NOTE:__ Use a display name that will help users understand what your package is intended for. |
|
|
||||||
| **version** | The package version number (**'MAJOR.MINOR.PATCH"**). This value must respect [semantic versioning](http://semver.org/). For more information, see [Package version](https://docs.unity3d.com/Manual/upm-manifestPkg.html#pkg-ver) in the Unity User Manual. |
|
|
||||||
| **unity** | The lowest Unity version the package is compatible with. If omitted, the package is considered compatible with all Unity versions. <br /><br />The expected format is "**<MAJOR>.<MINOR>**" (for example, **2018.3**). |
|
|
||||||
| **description** | A brief description of the package. This is the text that appears in the [details view](upm-ui-details) of the Packages window. Any [UTF-8](https://en.wikipedia.org/wiki/UTF-8) character code is supported. This means that you can use special formatting character codes, such as line breaks (**\n**) and bullets (**\u25AA**). |
|
|
||||||
|
|
||||||
Update the following recommended fields in file **package.json**:
|
|
||||||
|
|
||||||
| **Attribute name:** | **Description:** |
|
|
||||||
| ------------------- | ------------------------------------------------------------ |
|
|
||||||
| **dependencies** | A map of package dependencies. Keys are package names, and values are specific versions. They indicate other packages that this package depends on. For more information, see [Dependencies](https://docs.unity3d.com/Manual/upm-dependencies.html) in the Unity User Manual.<br /><br />**NOTE**: The Package Manager does not support range syntax, only **SemVer** versions. |
|
|
||||||
| **keywords** | An array of keywords used by the Package Manager search APIs. This helps users find relevant packages. |
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="Asmdef"></a>
|
|
||||||
### Updating the Assembly Definition files
|
|
||||||
|
|
||||||
You must associate scripts inside a package to an assembly definition file (.asmdef). Assembly definition files are the Unity equivalent to a C# project in the .NET ecosystem. You must set explicit references in the assembly definition file to other assemblies (whether in the same package or in external packages). See [Assembly Definitions](https://docs.unity3d.com/Manual/ScriptCompilationAssemblyDefinitionFiles.html) for more details.
|
|
||||||
|
|
||||||
Use these conventions for naming and storing your assembly definition files to ensure that the compiled assembly filenames follow the [.NET Framework Design Guidelines](https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/):
|
|
||||||
|
|
||||||
* Store Editor-specific code under a root editor assembly definition file:
|
|
||||||
|
|
||||||
`Editor/Lrss3.XericLibrary.Editor.asmdef`
|
|
||||||
|
|
||||||
* Store runtime-specific code under a root runtime assembly definition file:
|
|
||||||
|
|
||||||
`Runtime/Lrss3.XericLibrary.asmdef`
|
|
||||||
|
|
||||||
* Configure related test assemblies for your editor and runtime scripts:
|
|
||||||
|
|
||||||
`Tests/Editor/Lrss3.XericLibrary.Editor.Tests.asmdef`
|
|
||||||
|
|
||||||
`Tests/Runtime/Lrss3.XericLibrary.Tests.asmdef`
|
|
||||||
|
|
||||||
To get a more general view of a recommended package folder layout, see [Package layout](https://docs.unity3d.com/Manual/cus-layout.html).
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="Doc"></a>
|
|
||||||
### Providing documentation
|
|
||||||
|
|
||||||
Use the `Documentations~/Xeric Library.md` documentation file to create preliminary, high-level documentation. This document should introduce users to the features and sample files included in your package. Your package documentation files will be used to generate online and local docs, available from the Package Manager UI.
|
|
||||||
|
|
||||||
**Document your public APIs**
|
|
||||||
* All public APIs need to be documented with **XmlDoc**.
|
|
||||||
* API documentation is generated from [XmlDoc tags](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/xmldoc/xml-documentation-comments) included with all public APIs found in the package. See [Editor/EditorExample.cs](Editor/EditorExample.cs) for an example.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="Populate"></a>
|
|
||||||
### Adding Assets to your package
|
|
||||||
|
|
||||||
If your package contains a sample, rename the `Samples/Example` folder, and update the `.sample.json` file in it.
|
|
||||||
|
|
||||||
In the case where your package contains multiple samples, you can make a copy of the `Samples/Example` folder for each sample, and update the `.sample.json` file accordingly.
|
|
||||||
|
|
||||||
Similar to `.tests.json` file, there is a `"createSeparatePackage"` field in `.sample.json`. If set to true, the CI will create a separate package for the sample.
|
|
||||||
|
|
||||||
Delete the `Samples` folder altogether if your package does not need samples.
|
|
||||||
|
|
||||||
As of Unity release 2019.1, the Package Manager recognizes the `/Samples` directory in a package. Unity doesn't automatically import samples when a user adds the package to a Project. However, users can click a button in the details view of a package in the **Packages** window to optionally import samples into their `/Assets` directory.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="Valid"></a>
|
|
||||||
### Validating your package
|
|
||||||
|
|
||||||
Before you publish your package, you need to make sure that it passes all the necessary validation checks by using the Package Validation Suite extension (optional).
|
|
||||||
|
|
||||||
Once you install the Validation Suite package, a **Validate** button appears in the details view of a package in the **Packages** window. To install the extension, follow these steps:
|
|
||||||
|
|
||||||
1. Point your Project manifest to a staging registry by adding this line to the manifest:
|
|
||||||
`"registry": "https://staging-packages.unity.com"`
|
|
||||||
2. Install the **Package Validation Suite v0.3.0-preview.13** or above from the **Packages** window in Unity. Make sure the package scope is set to **All Packages**, and select **Show preview packages** from the **Advanced** menu.
|
|
||||||
3. After installation, a **Validate** button appears in the **Packages** window. Click the button to run a series of tests, then click the **See Results** button for additional information:
|
|
||||||
* If it succeeds, a green bar with a **Success** message appears.
|
|
||||||
* If it fails, a red bar with a **Failed** message appears.
|
|
||||||
|
|
||||||
**NOTE:** The validation suite is still in preview.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="Tests"></a>
|
|
||||||
### Adding tests to your package
|
|
||||||
|
|
||||||
All packages must contain tests. Tests are essential for Unity to ensure that the package works as expected in different scenarios.
|
|
||||||
|
|
||||||
**Editor tests**
|
|
||||||
* Write all your Editor Tests in `Tests/Editor`
|
|
||||||
|
|
||||||
**Playmode Tests**
|
|
||||||
|
|
||||||
* Write all your Playmode Tests in `Tests/Runtime`.
|
|
||||||
|
|
||||||
#### Separating the tests from the package
|
|
||||||
|
|
||||||
You can create a separate package for the tests, which allows you to exclude a large number of tests and Assets from being published in your main package, while still making it easy to test it.
|
|
||||||
|
|
||||||
Open the `Tests/.tests.json` file and set the **createSeparatePackage** attribute:
|
|
||||||
|
|
||||||
| **Value to set:** | **Result:** |
|
|
||||||
| ----------------- | ------------------------------------------------------------ |
|
|
||||||
| **true** | CI creates a separate package for these tests. At publish time, the Package Manager adds metadata to link the packages together. |
|
|
||||||
| **false** | Keep the tests as part of the published package. |
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="Legal"></a>
|
|
||||||
### Meeting the legal requirements
|
|
||||||
|
|
||||||
You can use the Third Party Notices.md file to make sure your package meets any legal requirements. For example, here is a sample license file from the Unity Timeline package:
|
|
||||||
|
|
||||||
```
|
|
||||||
Unity Timeline copyright © 2017-2019 Unity Technologies ApS
|
|
||||||
|
|
||||||
Licensed under the Unity Companion License for Unity-dependent projects--see [Unity Companion License](http://www.unity3d.com/legal/licenses/Unity_Companion_License).
|
|
||||||
|
|
||||||
Unless expressly provided otherwise, the Software under this license is made available strictly on an “AS IS” BASIS WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. Please review the license for details on these and other terms and conditions.
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Third Party Notices
|
|
||||||
|
|
||||||
If your package has third-party elements, you can include the licenses in a Third Party Notices.md file. You can include a **Component Name**, **License Type**, and **Provide License Details** section for each license you want to include. For example:
|
|
||||||
|
|
||||||
```
|
|
||||||
This package contains third-party software components governed by the license(s) indicated below:
|
|
||||||
|
|
||||||
Component Name: Semver
|
|
||||||
|
|
||||||
License Type: "MIT"
|
|
||||||
|
|
||||||
[SemVer License](https://github.com/myusername/semver/blob/master/License.txt)
|
|
||||||
|
|
||||||
Component Name: MyComponent
|
|
||||||
|
|
||||||
License Type: "MyLicense"
|
|
||||||
|
|
||||||
[MyComponent License](https://www.mycompany.com/licenses/License.txt)
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
**NOTE**: Any URLs you use should point to a location that contains the reproduced license and the copyright information (if applicable).
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ namespace XericLibrary.Runtime.MacroLibrary
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public const decimal Rad2Ang_m = 57.295779513082320876798154814105m;
|
public const decimal Rad2Ang_m = 57.295779513082320876798154814105m;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 角度转弧度
|
/// 角度转弧度
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -35,6 +34,31 @@ namespace XericLibrary.Runtime.MacroLibrary
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public const decimal Ang2Rad_m = .01745329251994329576923690768489m;
|
public const decimal Ang2Rad_m = .01745329251994329576923690768489m;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 45度余弦值
|
||||||
|
/// </summary>
|
||||||
|
public const float Cos45 = 0.70710678118654752440084436210485f;
|
||||||
|
/// <summary>
|
||||||
|
/// 45度余弦值
|
||||||
|
/// </summary>
|
||||||
|
public const double Cos45_d = 0.70710678118654752440084436210485d;
|
||||||
|
/// <summary>
|
||||||
|
/// 45度余弦值
|
||||||
|
/// </summary>
|
||||||
|
public const decimal Cos45_m = 0.70710678118654752440084436210485m;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 45度正弦值
|
||||||
|
/// </summary>
|
||||||
|
public const float Sin45 = 0.70710678118654752440084436210485f;
|
||||||
|
/// <summary>
|
||||||
|
/// 45度正弦值
|
||||||
|
/// </summary>
|
||||||
|
public const double Sin45_d = 0.70710678118654752440084436210485d;
|
||||||
|
/// <summary>
|
||||||
|
/// 45度正弦值
|
||||||
|
/// </summary>
|
||||||
|
public const decimal Sin45_m = 0.70710678118654752440084436210485m;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 最大可接受的误差
|
/// 最大可接受的误差
|
||||||
@@ -49,7 +73,6 @@ namespace XericLibrary.Runtime.MacroLibrary
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public const decimal MaxError_m = .00000001m;
|
public const decimal MaxError_m = .00000001m;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根号2的一半,用于快速平方根除以二
|
/// 根号2的一半,用于快速平方根除以二
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -140,5 +140,20 @@ namespace XericLibrary.Runtime.MacroLibrary
|
|||||||
{
|
{
|
||||||
target ^= Convert.ToInt32(value);
|
target ^= Convert.ToInt32(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查是否包含给定,且只关注是否完全包含
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="examineCC">要检查的特征</param>
|
||||||
|
/// <param name="filterCC">过滤的特征</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool CheckEnum(T examineCC, T filterCC)
|
||||||
|
{
|
||||||
|
var cc = Convert.ToInt32(filterCC);
|
||||||
|
var isValid = Convert.ToInt32(examineCC) & cc;
|
||||||
|
var isFull = isValid ^ cc;
|
||||||
|
|
||||||
|
return isValid > 0 && isFull <= 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEditor.Experimental.GraphView;
|
||||||
|
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
using Xorti = XericLibrary.Runtime.MacroLibrary.MacroMath;
|
||||||
|
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace XericLibrary.Runtime.MacroLibrary
|
||||||
|
{
|
||||||
|
public static class MacroEvent
|
||||||
|
{
|
||||||
|
#region 控制器
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保守事件控制器
|
||||||
|
/// </summary>
|
||||||
|
class ConservativeManager
|
||||||
|
{
|
||||||
|
#region 字段属性
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 事件索引器
|
||||||
|
/// </summary>
|
||||||
|
private Dictionary<int, int> EventIndex;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 事件状态寄存器
|
||||||
|
/// </summary>
|
||||||
|
private List<int> eventRegister;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 方法
|
||||||
|
|
||||||
|
public ConservativeManager()
|
||||||
|
{
|
||||||
|
EventIndex = new Dictionary<int, int>();
|
||||||
|
eventRegister = new List<int>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保守地利用控制器调用一个事件分发器
|
||||||
|
/// </summary>
|
||||||
|
public void InvokeConservative(Delegate targetevent)
|
||||||
|
{
|
||||||
|
var code = targetevent.GetHashCode();
|
||||||
|
int index = 0;
|
||||||
|
if(!EventIndex.TryGetValue(code, out index))
|
||||||
|
EventIndex.Add(code, EventIndex.Count);
|
||||||
|
targetevent.DynamicInvoke();// dynmic代表动态类型,包含装箱拆箱,速度会非常慢
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 事件
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保守地调用一个事件分发器
|
||||||
|
/// </summary>
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static bool InvokeConservative(this Action invokedEvent, int sign, ref int register)
|
||||||
|
{
|
||||||
|
if(Xorti.GetByteState(register, sign))
|
||||||
|
return false;
|
||||||
|
Xorti.SetByteState(ref register, sign, true);
|
||||||
|
invokedEvent?.Invoke();
|
||||||
|
Xorti.SetByteState(ref register, sign, false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保守地调用一个事件分发器
|
||||||
|
/// </summary>
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static bool InvokeConservative<PARAM>(this Action<PARAM> invokedEvent, PARAM input, int sign, ref int register)
|
||||||
|
{
|
||||||
|
if(Xorti.GetByteState(register, sign))
|
||||||
|
return false;
|
||||||
|
Xorti.SetByteState(ref register, sign, true);
|
||||||
|
invokedEvent?.Invoke(input);
|
||||||
|
Xorti.SetByteState(ref register, sign, false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2153f3f51f4097846b1b3442123f4433
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -4,6 +4,7 @@ using System.Collections.Generic;
|
|||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.Windows;
|
||||||
|
|
||||||
namespace XericLibrary.Runtime.MacroLibrary
|
namespace XericLibrary.Runtime.MacroLibrary
|
||||||
{
|
{
|
||||||
@@ -50,6 +51,21 @@ namespace XericLibrary.Runtime.MacroLibrary
|
|||||||
|
|
||||||
#region 数学
|
#region 数学
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// pmod
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="a"></param>
|
||||||
|
/// <param name="b"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static int PMod(int a, int b)
|
||||||
|
{
|
||||||
|
if(b <= 0)
|
||||||
|
return 0;
|
||||||
|
var mod = a % b;
|
||||||
|
return a < 0 ? (b + mod) % b : mod;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// pmod
|
/// pmod
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -8,6 +8,93 @@ namespace XericLibrary.Runtime.MacroLibrary
|
|||||||
{
|
{
|
||||||
#region 对象操作
|
#region 对象操作
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取一个变换节点下所有的子成员
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="trans"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static IEnumerable<Transform> GetChildren(this Transform trans)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < trans.childCount; i++)
|
||||||
|
{
|
||||||
|
yield return trans.GetChild(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 在所有子成员中深度优先找到第一个组件
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="trans"></param>
|
||||||
|
/// <param name="recursion">遍历深度,0表示仅在此处寻找,1表示在包含下一级在内的所有成员中寻找</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static IEnumerable<T> GetChildrenRecursionComponents<T>(this Transform trans, int recursion = 1)
|
||||||
|
where T : Component
|
||||||
|
{
|
||||||
|
int newRecursion = recursion - 1;
|
||||||
|
|
||||||
|
foreach(var item in trans.GetChildren())
|
||||||
|
{
|
||||||
|
var comp = item.GetComponent<T>();
|
||||||
|
if(comp == null && newRecursion > 0)
|
||||||
|
comp = item.GetChildrenRecursionComponent<T>(newRecursion);
|
||||||
|
yield return comp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 按深度优先寻找一个组件
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="trans"></param>
|
||||||
|
/// <param name="depth">遍历深度,0表示仅在第一子集中寻找,1表示在包含下一级在内的所有成员中寻找</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static T GetChildrenRecursionComponent<T>(this Transform trans, int depth = 1)
|
||||||
|
where T : Component
|
||||||
|
{
|
||||||
|
T result;
|
||||||
|
int newDepth = depth - 1;
|
||||||
|
|
||||||
|
#if true // 如果不知道这里在找什么的可以打开调试看看
|
||||||
|
foreach(var item in trans.GetChildren())
|
||||||
|
{
|
||||||
|
result = item.GetComponent<T>();
|
||||||
|
if(result == null && newDepth > 0)
|
||||||
|
result = item.GetChildrenRecursionComponent<T>(newDepth);
|
||||||
|
if(result != null)
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
string info = $"{depth}. 开始在{trans.name}中寻找\r\n";
|
||||||
|
foreach(var item in trans.GetChildren())
|
||||||
|
{
|
||||||
|
info += $"{depth}. > 正在{item.name}中寻找\r\n";
|
||||||
|
|
||||||
|
result = item.GetComponent<T>();
|
||||||
|
|
||||||
|
info += $"{depth}. 当前节点{(result == null ? "不包含组件":"包含组件")}\r\n";
|
||||||
|
|
||||||
|
if(result == null && newDepth >= 0)
|
||||||
|
{
|
||||||
|
info += $"{depth}. 前往深层寻找 > \r\n";
|
||||||
|
result = item.GetRecursionComponent<T>(newDepth);
|
||||||
|
info += $"{depth}. 深层查找返回 < \r\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(result != null)
|
||||||
|
{
|
||||||
|
info += $"{depth}. 已找到结果:{result.name} \r\n";
|
||||||
|
Debug.Log(info);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
info += $"{depth}. 没有找到任何东西 \r\n";
|
||||||
|
}
|
||||||
|
Debug.Log(info + "没有找到,空结束");
|
||||||
|
#endif
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 无论如何都要获取一个组件
|
/// 无论如何都要获取一个组件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Xeric.Runtime.MicroLibrary
|
namespace Xeric.Runtime.MicroLibrary
|
||||||
@@ -46,7 +48,26 @@ namespace Xeric.Runtime.MicroLibrary
|
|||||||
return new Vector3(input.x, input.y, input.z);
|
return new Vector3(input.x, input.y, input.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 世界向上表面坐标转换方法
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="vec"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static Vector3 ToVector3(this Vector2 vec)
|
||||||
|
=> new Vector3(vec.x, 0, vec.y);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 世界向上表面坐标转换方法
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="vec"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static Vector2 ToVector2(this Vector3 vec)
|
||||||
|
=> new Vector2(vec.x, vec.z);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,38 +123,6 @@ namespace XericLibrary.Runtime.MacroLibrary
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 事件
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 保守地调用一个事件分发器
|
|
||||||
/// </summary>
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public static bool InvokeConservative(this Action invokedEvent, int sign, ref int register)
|
|
||||||
{
|
|
||||||
if(Xorti.GetByteState(register, sign))
|
|
||||||
return false;
|
|
||||||
Xorti.SetByteState(ref register, sign, true);
|
|
||||||
invokedEvent?.Invoke();
|
|
||||||
Xorti.SetByteState(ref register, sign, false);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 保守地调用一个事件分发器
|
|
||||||
/// </summary>
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public static bool InvokeConservative<PARAM>(this Action<PARAM> invokedEvent, PARAM input, int sign, ref int register)
|
|
||||||
{
|
|
||||||
if(Xorti.GetByteState(register, sign))
|
|
||||||
return false;
|
|
||||||
Xorti.SetByteState(ref register, sign, true);
|
|
||||||
invokedEvent?.Invoke(input);
|
|
||||||
Xorti.SetByteState(ref register, sign, false);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region 对象
|
#region 对象
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -9,15 +9,6 @@ namespace XericLibrary.Runtime.MacroLibrary
|
|||||||
{
|
{
|
||||||
public static class Vector2Extend
|
public static class Vector2Extend
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// 李若辰规定的编辑表面坐标转换方法
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="vec"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public static Vector3 ToVector3(this Vector2 vec)
|
|
||||||
=> new Vector3(vec.x, 0, vec.y);
|
|
||||||
|
|
||||||
[Obsolete("unfinished")]
|
[Obsolete("unfinished")]
|
||||||
public static Vector2 Projection(this Vector2 point, Vector3 start, Vector3 end)
|
public static Vector2 Projection(this Vector2 point, Vector3 start, Vector3 end)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -209,16 +209,6 @@ namespace XericLibrary.Runtime.MacroLibrary
|
|||||||
public static Vector3 Negative(this Vector3 a)
|
public static Vector3 Negative(this Vector3 a)
|
||||||
=> new Vector3(-a.x, -a.y, -a.z);
|
=> new Vector3(-a.x, -a.y, -a.z);
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 李若辰规定的编辑表面坐标转换方法
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="vec"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public static Vector2 ToVector2(this Vector3 vec)
|
|
||||||
=> new Vector2(vec.x, vec.z);
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
public static Vector2 ToVector2(this Vector3 vec, string format)
|
public static Vector2 ToVector2(this Vector3 vec, string format)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 587860aad7413cb448a73fafadcc68c9
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,134 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
using XericLibrary.Runtime.Type;
|
||||||
|
|
||||||
|
namespace XericLibrary.Runtime.Security
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 程序流程保全
|
||||||
|
/// </summary>
|
||||||
|
public class ProgramFlowSecurity : WeaklyObject
|
||||||
|
{
|
||||||
|
#region 字段属性
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保护标志位
|
||||||
|
/// </summary>
|
||||||
|
private int conservativeFlag;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 单步标志位
|
||||||
|
/// </summary>
|
||||||
|
private int DoOnceFlag;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 构造
|
||||||
|
|
||||||
|
public ProgramFlowSecurity()
|
||||||
|
{
|
||||||
|
conservativeFlag = 0;
|
||||||
|
DoOnceFlag = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 方法
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 标志一段程序的开始
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="site"></param>
|
||||||
|
public void Start<T>(T site)
|
||||||
|
where T : struct, Enum
|
||||||
|
{
|
||||||
|
conservativeFlag |= Convert.ToInt32(site);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 标志一段程序的结束
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="site"></param>
|
||||||
|
public void Finish<T>(T site)
|
||||||
|
where T : struct, Enum
|
||||||
|
{
|
||||||
|
conservativeFlag &= ~Convert.ToInt32(site);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 尝试开始一段程序
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="site"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool TryStart<T>(T site)
|
||||||
|
where T : struct, Enum
|
||||||
|
{
|
||||||
|
if(GetFlag(site))
|
||||||
|
return false;
|
||||||
|
Start(site);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 开始执行一次
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="site"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool DoOnceStart<T>(T site)
|
||||||
|
where T : struct, Enum
|
||||||
|
{
|
||||||
|
if(GetFlag(site))
|
||||||
|
return false;
|
||||||
|
DoOnceFlag |= Convert.ToInt32(site);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 复位执行一次的标志
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="site"></param>
|
||||||
|
public void ResetDoOnce<T>(T site)
|
||||||
|
where T : struct, Enum
|
||||||
|
{
|
||||||
|
DoOnceFlag &= ~Convert.ToInt32(site);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取一段程序的标志位
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="site"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private bool GetFlag<T>(T site)
|
||||||
|
where T : struct, Enum
|
||||||
|
{
|
||||||
|
return (conservativeFlag & Convert.ToInt32(site)) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取一段程序的标志位
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="site"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private bool GetDoOnce<T>(T site)
|
||||||
|
where T : struct, Enum
|
||||||
|
{
|
||||||
|
return (DoOnceFlag & Convert.ToInt32(site)) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a7fec265b4bc05249b53e040d279b079
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
|
||||||
|
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
namespace XericLibrary.Runtime.Type
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 单例基础类,
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
public class SingleMonoBase<T> : MonoBehaviour
|
||||||
|
where T : Component
|
||||||
|
{
|
||||||
|
#region 字段属性
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 组件单例
|
||||||
|
/// </summary>
|
||||||
|
private static T inst;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取组件单例
|
||||||
|
/// </summary>
|
||||||
|
public static T Inst
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if(inst == null)
|
||||||
|
InstanceLaunch();
|
||||||
|
return inst;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 所有没有指定的目标的单例脚本组件的挂载节点
|
||||||
|
/// </summary>
|
||||||
|
private static GameObject globalEmptyNode;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 生命周期
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 基本单例组件中默认保留旧的成员,如果需要移除旧成员,请在base调用前调用DestroyInstanc()
|
||||||
|
/// </summary>
|
||||||
|
/// <exception cref="System.Exception"></exception>
|
||||||
|
protected virtual void Awake()
|
||||||
|
{
|
||||||
|
//if(DestroyInstance())
|
||||||
|
// Debug.LogError("初始警告:存在多个单例对象,已移除旧的项目");
|
||||||
|
|
||||||
|
inst = this as T;
|
||||||
|
if(inst == null)
|
||||||
|
throw new System.Exception("单例脚本给定类型错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 方法
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 移除一个单例实例
|
||||||
|
/// </summary>
|
||||||
|
protected bool DestroyInstance()
|
||||||
|
{
|
||||||
|
if(inst != null)
|
||||||
|
{
|
||||||
|
Destroy(inst.gameObject);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 实例在场景中无中生有时通过此过程进行初始化
|
||||||
|
/// </summary>
|
||||||
|
private static void InstanceLaunch()
|
||||||
|
{
|
||||||
|
if (globalEmptyNode == null)
|
||||||
|
globalEmptyNode = new GameObject("DoNotDestroyThis");
|
||||||
|
globalEmptyNode.AddComponent<T>();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7ffeec192c3ef0845b82859ad7f17b65
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -125,10 +125,7 @@ namespace XericLibrary.Runtime.Type
|
|||||||
|
|
||||||
public static bool operator ==(WeaklyMonoBase lhs, WeaklyMonoBase rhs)
|
public static bool operator ==(WeaklyMonoBase lhs, WeaklyMonoBase rhs)
|
||||||
{
|
{
|
||||||
if(lhs == null)
|
if(rhs is null) return lhs is null;
|
||||||
return rhs == null;
|
|
||||||
if(rhs == null)
|
|
||||||
return lhs == null;
|
|
||||||
return lhs.Equals(rhs);
|
return lhs.Equals(rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,7 +136,7 @@ namespace XericLibrary.Runtime.Type
|
|||||||
|
|
||||||
public static implicit operator bool(WeaklyMonoBase lhs)
|
public static implicit operator bool(WeaklyMonoBase lhs)
|
||||||
{
|
{
|
||||||
return lhs.Equals(null);
|
return lhs is not null;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -24,10 +24,7 @@ namespace XericLibrary.Runtime.Type
|
|||||||
|
|
||||||
public static bool operator ==(WeaklyObject lhs, WeaklyObject rhs)
|
public static bool operator ==(WeaklyObject lhs, WeaklyObject rhs)
|
||||||
{
|
{
|
||||||
if(lhs == null)
|
if(rhs is null) return lhs is null;
|
||||||
return rhs == null;
|
|
||||||
if(rhs == null)
|
|
||||||
return lhs == null;
|
|
||||||
return lhs.Equals(rhs);
|
return lhs.Equals(rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,7 +35,7 @@ namespace XericLibrary.Runtime.Type
|
|||||||
|
|
||||||
public static implicit operator bool(WeaklyObject lhs)
|
public static implicit operator bool(WeaklyObject lhs)
|
||||||
{
|
{
|
||||||
return lhs.Equals(null);
|
return lhs is not null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5d1285a3067988d44852b9da9116fc3f
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: baa6dfb306418024797d8a44d7ec382f
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8467cf9b285124f44b7abf3252dc65eb
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 82621b0cec53f174c9bc1cfab8d74a12
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0fd1e240ff69c444481507d83de222a3
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a13229ea43109f14c9eabc333c48ff22
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 03b1d8a2a8aeea449843adbf61ab0e9a
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ea08eb5d0b2c0e3479804a22fa882c5c
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 87f7cc264fd00c24a84aa845acabbb73
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7fe925c1442acfe48b0b6a939df46beb
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
|
||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "com.lrss3.xericlibrary",
|
"name": "com.lrss3.xericlibrary",
|
||||||
"displayName": "Xeric Library",
|
"displayName": "Xeric Library",
|
||||||
"version": "0.1.1",
|
"version": "0.2.1",
|
||||||
"unity": "2021.3",
|
"unity": "2021.3",
|
||||||
"description": "Replace this string with your own description of the package. This description appears in the Package Manager window when the user selects this package from the list. \n\nFor best results, use this text to summarize: \n\u25aa What the package does \n\u25aa How it can benefit the user \n\nNote: Special formatting characters are supported, including line breaks ('\\n') and bullets ('\\u25AA')."
|
"description": "\u901a\u7528\u5e93\u63d2\u4ef6\u3002"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user