123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- using LitJson;
- using UnityEngine;
- using UnityEngine.UI;
- using UnityEngine.Events;
- using System;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Collections;
- using System.Collections.Generic;
- using System.Security.Cryptography;
- public class Auxiliary : MonoBehaviour
- {
- #region 变量
- public string String;
- public Font Font;
- public GameObject Go;
- public List<GameObject> GoList;
- public List<SpriteRenderer> SrList;
- public static Auxiliary Inst;
- public static DESCryptoServiceProvider Des
- {
- get
- {
- if (_Des == null)
- {
- _Des = new DESCryptoServiceProvider();
- _Des.IV = Encoding.UTF8.GetBytes("12345678");
- _Des.Key = Encoding.UTF8.GetBytes("12345678");
- }
- return _Des;
- }
- set { _Des = value; }
- }
- private static DESCryptoServiceProvider _Des;
- #endregion
- private void Start()
- {
- Inst = this;
- }
-
- private void Update()
- {
- if (Input.GetKeyDown(KeyCode.P))
- {
- ManaData.Level += 10;
- }
- if (Input.GetKeyDown(KeyCode.O))
- {
- for (int i = 0; i < ManaData.SkillList.Count; i++)
- {
- ManaData.SkillList[i].ReceiveCool(1, true, true);
- }
- }
- if (Input.GetKeyDown(KeyCode.I))
- {
- ManaData.Coin += 1000;
- ManaData.Diamond += 1000;
- }
- if (Input.GetKeyDown(KeyCode.U))
- {
- Data.SavePlayerConfig();
- }
- if (Input.GetKeyDown(KeyCode.Y))
- {
- Data.ResetPlayerConfig();
- }
- if (Input.GetKeyDown(KeyCode.T))
- {
- if (Math.Abs(Time.timeScale) < 0.0005f)
- {
- Time.timeScale = 1;
- ManaLog.Log("<color=red>游戏已恢复</color>");
- }
- else
- {
- Time.timeScale = 0;
- ManaLog.Log("<color=red>游戏已暂停</color>");
- }
- }
- }
- public static byte[] Encrypt(string str)
- {
- byte[] bytes = Encoding.UTF8.GetBytes(str);
- byte[] encryptBytes = Des.CreateEncryptor().TransformFinalBlock(bytes, 0, bytes.Length);
- return encryptBytes;
- }
- public static string Decrypt(string str)
- {
- byte[] encryptBytes = ToBytes(str);
- byte[] decryptBytes = Des.CreateDecryptor().TransformFinalBlock(encryptBytes, 0, encryptBytes.Length);
- return Encoding.UTF8.GetString(decryptBytes);
- }
- public static void CompileDic(Transform tra, Dictionary<string, Transform> dic)
- {
- Transform[] transforms = tra.GetComponentsInChildren<Transform>(true);
- for (int i = 0; i < transforms.Length; i++)
- {
- if (dic.ContainsKey(transforms[i].name))
- {
- throw new Exception(transforms[i].name);
- }
- else
- {
- dic.Add(transforms[i].name, transforms[i]);
- }
- }
- }
- public static byte[] ToBytes(string str)
- {
- string[] strings = str.Split(' ');
- byte[] bytes = new byte[strings.Length];
- for (int i = 0; i < bytes.Length; i++)
- {
- bytes[i] = byte.Parse(strings[i]);
- }
- return bytes;
- }
- public static string ToString(byte[] bytes)
- {
- StringBuilder strB = new StringBuilder();
- for (int i = 0; i < bytes.Length; i++)
- {
- if (i == bytes.Length - 1)
- {
- strB.Append(bytes[i]);
- }
- else
- {
- strB.Append(bytes[i] + " ");
- }
- }
- return strB.ToString();
- }
- public void DelayCall(UnityAction function, int frame)
- {
- StartCoroutine(IDelayCall(function, frame));
- }
- public void DelayCall(UnityAction function, float time)
- {
- StartCoroutine(IDelayCall(function, time));
- }
- private static IEnumerator IDelayCall(UnityAction function, int frame)
- {
- int count = 0;
- if (count++ < frame)
- {
- yield return null;
- }
- function.Invoke();
- }
- private static IEnumerator IDelayCall(UnityAction function, float time)
- {
- yield return new WaitForSeconds(time);
- function.Invoke();
- }
- }
|