修改字符模块
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bae5611456f58c64eaa6b106bc0b75cc
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,37 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using MuHua;
|
||||
|
||||
/// <summary>
|
||||
/// 数据采集
|
||||
/// </summary>
|
||||
public class AnalysisCollector : Module<AnalysisCollector> {
|
||||
/// <summary> 接口 :https://api.mairui.club/hszbl/fsjy/股票代码(如000001)/分时级别/licence证书 </summary>
|
||||
public string API => "https://api.mairui.club/hszbl/fsjy/";
|
||||
|
||||
public void GetStock(string code, Action<List<DataAnalysis>> action, bool isCache = true) {
|
||||
string json = SaveTool.LoadText(FileName.Create(code));
|
||||
if (json != null && json != "" && isCache) { StockToAnalysis(json, action); return; }
|
||||
|
||||
//https://api.mairui.club/hszbl/fsjy/000001/60m/b997d4403688d5e66a
|
||||
string url = $"{API}{code}/dn/2E111385-7BF1-473D-9210-8E22AA75375A";
|
||||
Debug.Log($"{code}重新缓存了数据!");
|
||||
|
||||
DataRequestGet request = new DataRequestGet(url);
|
||||
request.OnError = (json) => { Debug.Log(json); };
|
||||
request.OnCallback = (json) => {
|
||||
SaveTool.SaveText(FileName.Create(code), json);
|
||||
StockToAnalysis(json, action);
|
||||
};
|
||||
request.SendAsync();
|
||||
}
|
||||
|
||||
public void StockToAnalysis(string json, Action<List<DataAnalysis>> action = null) {
|
||||
List<DataStock> stocks = JsonTool.FromJson<List<DataStock>>(json);
|
||||
List<DataAnalysis> analyses = new List<DataAnalysis>();
|
||||
for (int i = 0; i < stocks.Count; i++) { analyses.Add(stocks[i].To()); }
|
||||
action?.Invoke(analyses);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 06f3d6e55c2a1584ba20c9262c06704d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[Serializable]
|
||||
public class DataAnalysis {
|
||||
/// <summary> 日期 </summary>
|
||||
public string dateTime;
|
||||
/// <summary> 最高价(元) </summary>
|
||||
public float max;
|
||||
/// <summary> 最低价(元) </summary>
|
||||
public float min;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b4b97a8a3401e2a42903697e2b5acb2f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,42 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using UnityEngine;
|
||||
|
||||
[Serializable]
|
||||
public class DataStock {
|
||||
/// <summary> 日期 </summary>
|
||||
public string d;
|
||||
/// <summary> 开盘价(元) </summary>
|
||||
public string o;
|
||||
/// <summary> 最高价(元) </summary>
|
||||
public string h;
|
||||
/// <summary> 最低价(元) </summary>
|
||||
public string l;
|
||||
/// <summary> 收盘价(元) </summary>
|
||||
public string c;
|
||||
/// <summary> 成交量(手) </summary>
|
||||
public string v;
|
||||
/// <summary> 成交额(元) </summary>
|
||||
public string e;
|
||||
/// <summary> 振幅(%) </summary>
|
||||
public string zf;
|
||||
/// <summary> 换手率(%) </summary>
|
||||
public string hs;
|
||||
/// <summary> 涨跌幅(%) </summary>
|
||||
public string zd;
|
||||
/// <summary> 涨跌额(元) </summary>
|
||||
public string zde;
|
||||
/// <summary> </summary>
|
||||
public string ud;
|
||||
|
||||
public DataAnalysis To() {
|
||||
DataAnalysis analysis = new DataAnalysis();
|
||||
//analysis.dateTime = DateTime.ParseExact(d, "yyyy-MM-dd", CultureInfo.CurrentCulture);
|
||||
analysis.dateTime = d;
|
||||
analysis.max = float.Parse(h);
|
||||
analysis.min = float.Parse(l);
|
||||
return analysis;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4965f5d3a8eb6ef4ca7837688badb4e6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,16 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using MuHua;
|
||||
|
||||
/// <summary>
|
||||
/// 分析模块
|
||||
/// </summary>
|
||||
public class ModuleAnalysis : MonoBehaviour {
|
||||
public List<DataAnalysis> analyses;
|
||||
private void Start() {
|
||||
AnalysisCollector.I.GetStock("601658", (analyses) => { this.analyses = analyses; });
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 690f28715cec9bc41a56277db51f79fc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,11 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 交易模块
|
||||
/// </summary>
|
||||
public abstract class ModuleTrading {
|
||||
/// <summary> 执行交易 </summary>
|
||||
public abstract void Execute();
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 11336b15ef40f45488427630359ab3ba
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ebb2815476f460d48b87b8d80a3c1faa
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4cbc8837586bb7248990d0581e20725f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,32 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using MuHua;
|
||||
|
||||
// public class AnimalChasingState<T> : IStateMachine where T : Component {
|
||||
// public T target;
|
||||
// public string ToDefault = "Eating";
|
||||
// public readonly AnimalMachine animal;
|
||||
// public AnimalChasingState(StateMachine machine) : base(machine) => animal = machine as AnimalMachine;
|
||||
|
||||
// public override void Enter() {
|
||||
// bool valid = animal.Find(out target);
|
||||
// if (!valid) { animal.ChangeState("Idle"); }
|
||||
// }
|
||||
|
||||
// public override void Exit() {
|
||||
// animal.movement.StopMoving();
|
||||
// animal.animator.SetFloat("MoveSpeed", 0);
|
||||
// }
|
||||
|
||||
// public override void Trigger() {
|
||||
|
||||
// }
|
||||
|
||||
// public override void Update() {
|
||||
// if (target == null) { animal.ChangeState(ToDefault); return; }
|
||||
// bool complete = animal.movement.UpdateMove(target.transform.position);
|
||||
// animal.animator.SetFloat("MoveSpeed", animal.movement.currentSpeed);
|
||||
// if (complete) { animal.ChangeState(ToDefault); }
|
||||
// }
|
||||
// }
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 246d20af4dd47a14b9151feca52b870d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,39 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using MuHua;
|
||||
|
||||
// public class AnimalEatingState : IStateMachine {
|
||||
// public string ToDefault = "Idle";
|
||||
|
||||
// private AnimalFood target;
|
||||
|
||||
// public AnimalMachine animal;
|
||||
// public AnimalEatingState(StateMachine machine) : base(machine) => animal = machine as AnimalMachine;
|
||||
|
||||
// public override void Enter() {
|
||||
// if (!animal.Find(out target)) { Exit(); return; }
|
||||
|
||||
// // 判断target距离是否小于0.3f
|
||||
// float distance = Vector3.Distance(animal.transform.position, target.transform.position);
|
||||
// if (distance >= 0.1f) { Exit(); return; }
|
||||
|
||||
// animal.animator.SetBool("Eating", true);
|
||||
// }
|
||||
|
||||
// public override void Exit() {
|
||||
// animal.animator.SetBool("Eating", false);
|
||||
// }
|
||||
|
||||
// public override void Trigger() {
|
||||
// animal.hunger += target.nutritionValue;
|
||||
// animal.hunger = Mathf.Clamp(animal.hunger, 0, animal.maxHunger);
|
||||
// GameObject.Destroy(target.gameObject);
|
||||
|
||||
// animal.ChangeState(ToDefault);
|
||||
// }
|
||||
|
||||
// public override void Update() {
|
||||
|
||||
// }
|
||||
// }
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5d6c47e58145a2b44a20a3535cadc301
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AnimalFood : MonoBehaviour
|
||||
{
|
||||
public float nutritionValue = 20.0f; // 饱食度增加值
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d83ffa2b763f0214298151e204ea0872
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,30 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using MuHua;
|
||||
|
||||
// public class AnimalIdleState : IStateMachine {
|
||||
// public string ToDefault = "Roaming";
|
||||
|
||||
// private float idleTime;
|
||||
|
||||
// public AnimalMachine animal;
|
||||
// public AnimalIdleState(StateMachine machine) : base(machine) => animal = machine as AnimalMachine;
|
||||
|
||||
// public override void Enter() {
|
||||
// idleTime = Random.Range(3.0f, 5.0f);
|
||||
// }
|
||||
|
||||
// public override void Exit() {
|
||||
|
||||
// }
|
||||
|
||||
// public override void Trigger() {
|
||||
|
||||
// }
|
||||
|
||||
// public override void Update() {
|
||||
// idleTime -= Time.deltaTime;
|
||||
// if (idleTime <= 0) { animal.ChangeState(ToDefault); }
|
||||
// }
|
||||
// }
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8defd42d4b3f4a544bbeb381cb525533
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,81 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using MuHua;
|
||||
|
||||
// public class AnimalMachine : StateMachine {
|
||||
// [Header("饥饿度参数")]
|
||||
// public float hunger = 100.0f; // 饥饿度,从0到100
|
||||
// public float maxHunger = 100.0f; // 最大饥饿度
|
||||
// public float searchRadius = 10.0f; // 搜索食物的半径
|
||||
|
||||
// [Header("控制组件")]
|
||||
// public Movement movement; // 运动控制器
|
||||
// public Animator animator; // 动画控制器
|
||||
|
||||
// private float hungerTimer = 0.0f; // 计时器
|
||||
// private float chasingCooldownTimer = 0.0f; // 追逐状态冷却计时器
|
||||
// private const float chasingCooldown = 5.0f; // 追逐状态冷却时间
|
||||
|
||||
// protected override void InitializeStates() {
|
||||
// RegisterState("Idle", new AnimalIdleState(this));
|
||||
// RegisterState("Roaming", new AnimalRoamingState(this));
|
||||
// RegisterState("Chasing", new AnimalChasingState<AnimalFood>(this));
|
||||
// RegisterState("Eating", new AnimalEatingState(this));
|
||||
|
||||
// ChangeState("Idle");
|
||||
// }
|
||||
|
||||
// protected override void Update() {
|
||||
// base.Update();
|
||||
|
||||
// // 更新计时器
|
||||
// hungerTimer += Time.deltaTime;
|
||||
// chasingCooldownTimer += Time.deltaTime;
|
||||
|
||||
// if (hungerTimer >= 1.0f) { ConsumeHunger(); }
|
||||
// }
|
||||
|
||||
// public virtual void ConsumeHunger() {
|
||||
// // 重置计时器
|
||||
// hungerTimer = 0.0f;
|
||||
// // 每次消耗1点饥饿度
|
||||
// hunger -= 1.0f;
|
||||
// if (hunger < 0.0f) { hunger = 0.0f; }
|
||||
|
||||
// // 如果饥饿度低于最大饥饿度的70%,有50%的概率触发Chasing状态
|
||||
// // 如果饥饿度低于最大饥饿度的30%,有90%的概率触发Chasing状态
|
||||
// float foraging = hunger < maxHunger * 0.3f ? 0.9f : 0.5f;
|
||||
// bool valid = hunger < maxHunger * 0.7f && Random.value < foraging;
|
||||
|
||||
// // 如果触发Chasing状态,且冷却时间已过,切换到Chasing状态
|
||||
// if (valid && chasingCooldownTimer >= chasingCooldown) {
|
||||
// ChangeState("Chasing");
|
||||
// chasingCooldownTimer = 0.0f; // 重置冷却计时器
|
||||
// }
|
||||
// }
|
||||
|
||||
// // 从指定范围内查找指定类型的组件
|
||||
// public virtual bool Find<T>(out T value) where T : Component {
|
||||
// Collider[] colliders = Physics.OverlapSphere(transform.position, searchRadius);
|
||||
// foreach (Collider collider in colliders) {
|
||||
// T component = collider.GetComponent<T>();
|
||||
// if (component != null) {
|
||||
// value = component;
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// value = null;
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// // public override bool UpdateMove(Vector3 position) {
|
||||
// // return movement.UpdateMove(position);
|
||||
// // }
|
||||
// // public override void AnimationTrigger(string value) {
|
||||
// // throw new System.NotImplementedException();
|
||||
// // }
|
||||
// // public override void AnimationEnd() {
|
||||
// // throw new System.NotImplementedException();
|
||||
// // }
|
||||
// }
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a513572e2996d4748acb2838b4cadc89
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,30 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using MuHua;
|
||||
|
||||
// public class AnimalRoamingState : IStateMachine {
|
||||
// public Vector3 targetPosition;
|
||||
// public string ToDefault = "Idle";
|
||||
// public readonly AnimalMachine animal;
|
||||
// public AnimalRoamingState(StateMachine machine) : base(machine) => animal = machine as AnimalMachine;
|
||||
|
||||
// public override void Enter() {
|
||||
// targetPosition = animal.movement.RandomTargetPosition();
|
||||
// }
|
||||
|
||||
// public override void Exit() {
|
||||
// animal.movement.StopMoving();
|
||||
// animal.animator.SetFloat("MoveSpeed", 0);
|
||||
// }
|
||||
|
||||
// public override void Trigger() {
|
||||
|
||||
// }
|
||||
|
||||
// public override void Update() {
|
||||
// bool complete = animal.movement.UpdateMove(targetPosition);
|
||||
// animal.animator.SetFloat("MoveSpeed", animal.movement.currentSpeed);
|
||||
// if (complete) { animal.ChangeState(ToDefault); }
|
||||
// }
|
||||
// }
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 494833b7d85b90743956831570b1c49e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fc54f6ddf4030054f974974bf79889d6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user