This commit is contained in:
2020-07-04 14:41:25 +08:00
parent 70c346d2c1
commit a8f02e4da5
3748 changed files with 587372 additions and 0 deletions

View File

@@ -0,0 +1,142 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Coolape
{
public static class CLASCIICode
{
static Dictionary<char, string> _AsciiCodeMap = null;
public static Dictionary<char, string> AsciiCodeMap
{
get
{
if (_AsciiCodeMap == null)
{
_AsciiCodeMap = new Dictionary<char, string>();
//string keyboardStrs = "`1234567890-=~!@#$%^&*()_+\tqwertyuiop[]\\asdfghjkl;'zxcvbnm,./QWERTYUIOP{}|ASDFGHJKL:\"ZXCVBNM<>? ";
//string str = "";
//Debug.LogError(keyboardStrs.Length);
//for (int i = 0; i < keyboardStrs.Length; i++)
//{
// _AsciiCodeMap[keyboardStrs[i]] = NumEx.nStrForLen((int)(keyboardStrs[i]), 4);
// str = PStr.b().a(str).a("_AsciiCodeMap.Add(\'").a(keyboardStrs[i]).a("', \"").a(NumEx.nStrForLen((int)(keyboardStrs[i]), 4)).a("\");\n").e();
//}
//Debug.LogError(str);
_AsciiCodeMap.Add('`', "0096");
_AsciiCodeMap.Add('1', "0049");
_AsciiCodeMap.Add('2', "0050");
_AsciiCodeMap.Add('3', "0051");
_AsciiCodeMap.Add('4', "0052");
_AsciiCodeMap.Add('5', "0053");
_AsciiCodeMap.Add('6', "0054");
_AsciiCodeMap.Add('7', "0055");
_AsciiCodeMap.Add('8', "0056");
_AsciiCodeMap.Add('9', "0057");
_AsciiCodeMap.Add('0', "0048");
_AsciiCodeMap.Add('-', "0045");
_AsciiCodeMap.Add('=', "0061");
_AsciiCodeMap.Add('~', "0126");
_AsciiCodeMap.Add('!', "0033");
_AsciiCodeMap.Add('@', "0064");
_AsciiCodeMap.Add('#', "0035");
_AsciiCodeMap.Add('$', "0036");
_AsciiCodeMap.Add('%', "0037");
_AsciiCodeMap.Add('^', "0094");
_AsciiCodeMap.Add('&', "0038");
_AsciiCodeMap.Add('*', "0042");
_AsciiCodeMap.Add('(', "0040");
_AsciiCodeMap.Add(')', "0041");
_AsciiCodeMap.Add('_', "0095");
_AsciiCodeMap.Add('+', "0043");
_AsciiCodeMap.Add('\t', "0009");
_AsciiCodeMap.Add('q', "0113");
_AsciiCodeMap.Add('w', "0119");
_AsciiCodeMap.Add('e', "0101");
_AsciiCodeMap.Add('r', "0114");
_AsciiCodeMap.Add('t', "0116");
_AsciiCodeMap.Add('y', "0121");
_AsciiCodeMap.Add('u', "0117");
_AsciiCodeMap.Add('i', "0105");
_AsciiCodeMap.Add('o', "0111");
_AsciiCodeMap.Add('p', "0112");
_AsciiCodeMap.Add('[', "0091");
_AsciiCodeMap.Add(']', "0093");
_AsciiCodeMap.Add('\\', "0092");
_AsciiCodeMap.Add('a', "0097");
_AsciiCodeMap.Add('s', "0115");
_AsciiCodeMap.Add('d', "0100");
_AsciiCodeMap.Add('f', "0102");
_AsciiCodeMap.Add('g', "0103");
_AsciiCodeMap.Add('h', "0104");
_AsciiCodeMap.Add('j', "0106");
_AsciiCodeMap.Add('k', "0107");
_AsciiCodeMap.Add('l', "0108");
_AsciiCodeMap.Add(';', "0059");
_AsciiCodeMap.Add('\'', "0039");
_AsciiCodeMap.Add('z', "0122");
_AsciiCodeMap.Add('x', "0120");
_AsciiCodeMap.Add('c', "0099");
_AsciiCodeMap.Add('v', "0118");
_AsciiCodeMap.Add('b', "0098");
_AsciiCodeMap.Add('n', "0110");
_AsciiCodeMap.Add('m', "0109");
_AsciiCodeMap.Add(',', "0044");
_AsciiCodeMap.Add('.', "0046");
_AsciiCodeMap.Add('/', "0047");
_AsciiCodeMap.Add('Q', "0081");
_AsciiCodeMap.Add('W', "0087");
_AsciiCodeMap.Add('E', "0069");
_AsciiCodeMap.Add('R', "0082");
_AsciiCodeMap.Add('T', "0084");
_AsciiCodeMap.Add('Y', "0089");
_AsciiCodeMap.Add('U', "0085");
_AsciiCodeMap.Add('I', "0073");
_AsciiCodeMap.Add('O', "0079");
_AsciiCodeMap.Add('P', "0080");
_AsciiCodeMap.Add('{', "0123");
_AsciiCodeMap.Add('}', "0125");
_AsciiCodeMap.Add('|', "0124");
_AsciiCodeMap.Add('A', "0065");
_AsciiCodeMap.Add('S', "0083");
_AsciiCodeMap.Add('D', "0068");
_AsciiCodeMap.Add('F', "0070");
_AsciiCodeMap.Add('G', "0071");
_AsciiCodeMap.Add('H', "0072");
_AsciiCodeMap.Add('J', "0074");
_AsciiCodeMap.Add('K', "0075");
_AsciiCodeMap.Add('L', "0076");
_AsciiCodeMap.Add(':', "0058");
_AsciiCodeMap.Add('"', "0034");
_AsciiCodeMap.Add('Z', "0090");
_AsciiCodeMap.Add('X', "0088");
_AsciiCodeMap.Add('C', "0067");
_AsciiCodeMap.Add('V', "0086");
_AsciiCodeMap.Add('B', "0066");
_AsciiCodeMap.Add('N', "0078");
_AsciiCodeMap.Add('M', "0077");
_AsciiCodeMap.Add('<', "0060");
_AsciiCodeMap.Add('>', "0062");
_AsciiCodeMap.Add('?', "0063");
_AsciiCodeMap.Add(' ', "0032");
}
return _AsciiCodeMap;
}
}
public static string getCode(char key)
{
if (AsciiCodeMap.ContainsKey(key))
{
return AsciiCodeMap[key];
} else {
return null;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f4d4539d04a0b4f1da90c3ac7361bddc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,341 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Coolape
{
public static class CLCoder
{
/// <summary>
/// Bgnuadd the specified nu1 and nu2.大数相加
/// </summary>
/// <param name='nu1'>
/// Nu1.
/// </param>
/// <param name='nu2'>
/// Nu2.
/// </param>
static string bgNumAdd(string nu1, string nu2)
{
if (string.IsNullOrEmpty(nu2))
return nu1;
if (string.IsNullOrEmpty(nu1))
return nu2;
string result = "";
if (nu1[0] == '-' && nu2[0] != '-')// 'nu1为负、nu2为正
{
result = bignumbersubduct(nu2, nu1.Substring(1));
}
else if (nu1[0] == '-' && nu2[0] == '-')// 'nu1为负、nu2为负
{
result = "-" + bignumberadditive(nu1.Substring(1), nu2.Substring(1));
}
else if (nu1[0] != '-' && nu2[0] != '-')// 'nu1为正、nu2为正
{
result = bignumberadditive(nu1, nu2);
}
else if (nu1[0] != '-' && nu2[0] == '-')// 'nu1为正、nu2为负
{
result = bignumbersubduct(nu1, nu2.Substring(1));
}
return result;
}
/// <summary>
/// Bgnusub the specified nu1 and nu2.大数相减
/// </summary>
/// <param name='nu1'>
/// Nu1.
/// </param>
/// <param name='nu2'>
/// Nu2.
/// </param>
public static string bgNumSub(string nu1, string nu2)
{
if (string.IsNullOrEmpty(nu2))
return nu1;
if (string.IsNullOrEmpty(nu1))
return nu2;
string result = "";
if (nu1[0] == '-' && nu2[0] != '-') // 'nu1为负、nu2为正
{
result = "-" + bignumberadditive(nu1.Substring(1), nu2);
}
else if (nu1[0] == '-' && nu2[0] == '-') // 'nu1为负、nu2为负
{
result = bignumbersubduct(nu2.Substring(1), nu1.Substring(1));
}
else if (nu1[0] != '-' && nu2[0] != '-') // 'nu1为正、nu2为正
{
result = bignumbersubduct(nu1, nu2);
}
else if (nu1[0] != '-' && nu2[0] == '-') // 'nu1为正、nu2为负
{
result = bignumberadditive(nu1, nu2.Substring(1));
}
return result;
}
/// <summary>
/// Bignumberadditive the specified nu1 and nu2.
/// 大数相加以4位长的数字分段计算两个参数是不代符号的
/// </summary>
/// <param name='nu1'>
/// Nu1.
/// </param>
/// <param name='nu2'>
/// Nu2.
/// </param>
static string bignumberadditive(string nu1, string nu2)
{
string result = "";
string a = "";
string b = "";
int sizea = 0;
int sizeb = 0;
string tmpstr;
int i = 0;
a = nu1;
b = nu2;
if (a.Length < b.Length)
{
tmpstr = a;
a = b;
b = tmpstr;
}
if (a.Length % 4 == 0)
{
sizea = a.Length / 4;
}
else
{
sizea = a.Length / 4 + 1;
}
if (b.Length % 4 == 0)
{
sizeb = b.Length / 4;
}
else
{
sizeb = b.Length / 4 + 1;
}
string[] lista = new string[sizea];
string[] tmpresult = new string[sizea];
string[] listb = new string[sizeb];
for (i = 0; i < sizea; i++)
{
if (a.Length > 4)
{
lista[i] = StrEx.Right(a, 4);
a = StrEx.Left(a, a.Length - 4);
}
else
{
lista[i] = StrEx.Right(a, a.Length);
a = StrEx.Left(a, a.Length);
}
}
for (i = 0; i < sizeb; i++)
{
if (b.Length > 4)
{
listb[i] = StrEx.Right(b, 4);
b = StrEx.Left(b, b.Length - 4);
}
else
{
listb[i] = StrEx.Right(b, b.Length);
b = StrEx.Left(b, b.Length);
}
}
for (i = 0; i < sizea; i++)
{
if (i < sizeb)
{
tmpresult[i] = (NumEx.stringToInt(lista[i]) + NumEx.stringToInt(listb[i])).ToString();
}
else
{
tmpresult[i] = lista[i];
}
if (i != 0)
{
if ((tmpresult[i - 1]).Length == 5)
{
tmpresult[i] = (NumEx.stringToInt(tmpresult[i]) + 1).ToString();
}
}
if (i != sizea - 1)
{
int tmpN = 0;
if (tmpresult[i].Length >= 4)
{
tmpN = NumEx.stringToInt(StrEx.Right(tmpresult[i], 4));
}
else
{
tmpN = NumEx.stringToInt(tmpresult[i]);
}
result = NumEx.nStrForLen(tmpN, 4) + result;
}
else
{
result = tmpresult[i] + result;
}
}
return result;
}
/// <summary>
/// Bignumbersubduct the specified nu1 and nu2.
/// 大数相减以4位长的数字分段计算
/// 两个参数是不代符号的
/// </summary>
/// <param name='nu1'>
/// Nu1.
/// </param>
/// <param name='nu2'>
/// Nu2.
/// </param>
static string bignumbersubduct(string nu1, string nu2)
{
string result = "";
string a;
string b;
string tmpstr;
int sizea = 0;
int sizeb = 0;
int i = 0;
string flag = "";
a = nu1;
b = nu2;
if (a.Length < b.Length)
{
tmpstr = a;
a = b;
b = tmpstr;
flag = "-";
}
else if (a.Length == b.Length)
{
if (a.CompareTo(b) == -1)
{
tmpstr = a;
a = b;
b = tmpstr;
flag = "-";
}
}
if (a.Length % 4 == 0)
{
sizea = a.Length / 4;
}
else
{
sizea = a.Length / 4 + 1;
}
if (b.Length % 4 == 0)
{
sizeb = b.Length / 4;
}
else
{
sizeb = b.Length / 4 + 1;
}
string[] lista = new string[sizea];
string[] tmpresult = new string[sizea];
string[] listb = new string[sizeb];
for (i = 0; i < sizea; i++)
{
if (a.Length > 4)
{
lista[i] = StrEx.Right(a, 4);
a = StrEx.Left(a, a.Length - 4);
}
else
{
lista[i] = StrEx.Right(a, a.Length);
a = StrEx.Left(a, a.Length);
}
}
for (i = 0; i < sizeb; i++)
{
if (b.Length > 4)
{
listb[i] = StrEx.Right(b, 4);
b = StrEx.Left(b, b.Length - 4);
}
else
{
listb[i] = StrEx.Right(b, b.Length);
b = StrEx.Left(b, b.Length);
}
}
for (i = 0; i < sizea; i++)
{
if (i < sizeb)
{
if (i != sizea - 1)
{
tmpresult[i] = (NumEx.stringToInt("1" + lista[i]) - NumEx.stringToInt(listb[i])).ToString();
}
else
{
tmpresult[i] = (NumEx.stringToInt(lista[i]) - NumEx.stringToInt(listb[i])).ToString();
}
}
else
{
if (i != sizea - 1)
{
tmpresult[i] = "1" + lista[i];
}
else
{
tmpresult[i] = lista[i];
}
}
if (i != 0)
{
if (tmpresult[i - 1].Length < 5)
{
tmpresult[i] = (NumEx.stringToInt(tmpresult[i]) - 1).ToString();
}
}
if (i != sizea - 1)
{
int tempN = 0;
if (tmpresult[i].Length >= 4)
{
tempN = NumEx.stringToInt(StrEx.Right(tmpresult[i], 4));
}
else
{
tempN = NumEx.stringToInt(tmpresult[i]);
}
result = NumEx.nStrForLen(tempN, 4) + result;
}
else
{
result = tmpresult[i] + result;
}
}
result = flag + result;
return result;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c52d9cea545fc4c54897dd22cd4c4645
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: