基础实现初步成型
This commit is contained in:
commit
37f3fa7765
|
@ -0,0 +1,3 @@
|
|||
*/bin/*
|
||||
*/obj/*
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,138 @@
|
|||
{
|
||||
"Version": 1,
|
||||
"WorkspaceRootPath": "D:\\Projects\\CSharp\\SharpWorld\\",
|
||||
"Documents": [
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{63F41712-9AFE-4DCB-8B35-6782AFAB7BCF}|SharpWorld\\SharpWorld.csproj|d:\\projects\\csharp\\sharpworld\\sharpworld\\movement.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{63F41712-9AFE-4DCB-8B35-6782AFAB7BCF}|SharpWorld\\SharpWorld.csproj|solutionrelative:sharpworld\\movement.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{63F41712-9AFE-4DCB-8B35-6782AFAB7BCF}|SharpWorld\\SharpWorld.csproj|d:\\projects\\csharp\\sharpworld\\sharpworld\\shapevolume.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{63F41712-9AFE-4DCB-8B35-6782AFAB7BCF}|SharpWorld\\SharpWorld.csproj|solutionrelative:sharpworld\\shapevolume.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{63F41712-9AFE-4DCB-8B35-6782AFAB7BCF}|SharpWorld\\SharpWorld.csproj|d:\\projects\\csharp\\sharpworld\\sharpworld\\massfoster.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{63F41712-9AFE-4DCB-8B35-6782AFAB7BCF}|SharpWorld\\SharpWorld.csproj|solutionrelative:sharpworld\\massfoster.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{63F41712-9AFE-4DCB-8B35-6782AFAB7BCF}|SharpWorld\\SharpWorld.csproj|d:\\projects\\csharp\\sharpworld\\sharpworld\\entityspawn.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{63F41712-9AFE-4DCB-8B35-6782AFAB7BCF}|SharpWorld\\SharpWorld.csproj|solutionrelative:sharpworld\\entityspawn.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{63F41712-9AFE-4DCB-8B35-6782AFAB7BCF}|SharpWorld\\SharpWorld.csproj|d:\\projects\\csharp\\sharpworld\\sharpworld\\coreimplement.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{63F41712-9AFE-4DCB-8B35-6782AFAB7BCF}|SharpWorld\\SharpWorld.csproj|solutionrelative:sharpworld\\coreimplement.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{63F41712-9AFE-4DCB-8B35-6782AFAB7BCF}|SharpWorld\\SharpWorld.csproj|d:\\projects\\csharp\\sharpworld\\sharpworld\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{63F41712-9AFE-4DCB-8B35-6782AFAB7BCF}|SharpWorld\\SharpWorld.csproj|solutionrelative:sharpworld\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
}
|
||||
],
|
||||
"DocumentGroupContainers": [
|
||||
{
|
||||
"Orientation": 0,
|
||||
"VerticalTabListWidth": 256,
|
||||
"DocumentGroups": [
|
||||
{
|
||||
"DockedWidth": 187,
|
||||
"SelectedChildIndex": 7,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:129:0:{1fc202d4-d401-403c-9834-5b218574bb67}"
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:130:0:{1fc202d4-d401-403c-9834-5b218574bb67}"
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:128:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 4,
|
||||
"Title": "CoreImplement.cs",
|
||||
"DocumentMoniker": "D:\\Projects\\CSharp\\SharpWorld\\SharpWorld\\CoreImplement.cs",
|
||||
"RelativeDocumentMoniker": "SharpWorld\\CoreImplement.cs",
|
||||
"ToolTip": "D:\\Projects\\CSharp\\SharpWorld\\SharpWorld\\CoreImplement.cs",
|
||||
"RelativeToolTip": "SharpWorld\\CoreImplement.cs",
|
||||
"ViewState": "AQIAAHcAAAAAAAAAAAAAAIIAAABVAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-07-23T04:58:50.253Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 3,
|
||||
"Title": "EntitySpawn.cs",
|
||||
"DocumentMoniker": "D:\\Projects\\CSharp\\SharpWorld\\SharpWorld\\EntitySpawn.cs",
|
||||
"RelativeDocumentMoniker": "SharpWorld\\EntitySpawn.cs",
|
||||
"ToolTip": "D:\\Projects\\CSharp\\SharpWorld\\SharpWorld\\EntitySpawn.cs",
|
||||
"RelativeToolTip": "SharpWorld\\EntitySpawn.cs",
|
||||
"ViewState": "AQIAACQAAAAAAAAAAAAAAHUAAAA6AAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-07-22T08:53:39.007Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 2,
|
||||
"Title": "MassFoster.cs",
|
||||
"DocumentMoniker": "D:\\Projects\\CSharp\\SharpWorld\\SharpWorld\\MassFoster.cs",
|
||||
"RelativeDocumentMoniker": "SharpWorld\\MassFoster.cs",
|
||||
"ToolTip": "D:\\Projects\\CSharp\\SharpWorld\\SharpWorld\\MassFoster.cs",
|
||||
"RelativeToolTip": "SharpWorld\\MassFoster.cs",
|
||||
"ViewState": "AQIAABUAAAAAAAAAAAAAAB0AAAAuAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-07-23T03:03:10.984Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "Movement.cs",
|
||||
"DocumentMoniker": "D:\\Projects\\CSharp\\SharpWorld\\SharpWorld\\Movement.cs",
|
||||
"RelativeDocumentMoniker": "SharpWorld\\Movement.cs",
|
||||
"ToolTip": "D:\\Projects\\CSharp\\SharpWorld\\SharpWorld\\Movement.cs",
|
||||
"RelativeToolTip": "SharpWorld\\Movement.cs",
|
||||
"ViewState": "AQIAAB8AAAAAAAAAAAAgwCYAAABRAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-07-23T02:09:29.365Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 1,
|
||||
"Title": "ShapeVolume.cs",
|
||||
"DocumentMoniker": "D:\\Projects\\CSharp\\SharpWorld\\SharpWorld\\ShapeVolume.cs",
|
||||
"RelativeDocumentMoniker": "SharpWorld\\ShapeVolume.cs",
|
||||
"ToolTip": "D:\\Projects\\CSharp\\SharpWorld\\SharpWorld\\ShapeVolume.cs",
|
||||
"RelativeToolTip": "SharpWorld\\ShapeVolume.cs",
|
||||
"ViewState": "AQIAABgAAAAAAAAAAAAAADoAAAAjAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-07-22T08:04:52.642Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 5,
|
||||
"Title": "Program.cs",
|
||||
"DocumentMoniker": "D:\\Projects\\CSharp\\SharpWorld\\SharpWorld\\Program.cs",
|
||||
"RelativeDocumentMoniker": "SharpWorld\\Program.cs",
|
||||
"ToolTip": "D:\\Projects\\CSharp\\SharpWorld\\SharpWorld\\Program.cs",
|
||||
"RelativeToolTip": "SharpWorld\\Program.cs",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAsAAAAbAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-07-22T08:33:04.362Z",
|
||||
"EditorCaption": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.10.34928.147
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpWorld", "SharpWorld\SharpWorld.csproj", "{63F41712-9AFE-4DCB-8B35-6782AFAB7BCF}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{63F41712-9AFE-4DCB-8B35-6782AFAB7BCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{63F41712-9AFE-4DCB-8B35-6782AFAB7BCF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{63F41712-9AFE-4DCB-8B35-6782AFAB7BCF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{63F41712-9AFE-4DCB-8B35-6782AFAB7BCF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {C89043E1-A722-436E-A5C3-23FD223C939D}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,195 @@
|
|||
using MassFoster;
|
||||
using ShapeVolume;
|
||||
using Movement;
|
||||
using SharpWorld;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Variables;
|
||||
using System.Data;
|
||||
using EntitySpawn;
|
||||
|
||||
namespace CoreImplement
|
||||
{
|
||||
public class SystemHost : WsSystemHost
|
||||
{
|
||||
private UInt128 current_entity_id = 5;
|
||||
public UInt128 AllocNewID()
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
return current_entity_id++;
|
||||
}
|
||||
}
|
||||
|
||||
private Dictionary<string, WsBaseSystem> _system_store = new Dictionary<string, WsBaseSystem>();
|
||||
|
||||
public WsSystem<Datas> GetSystem<Datas, Sys>() where Datas : WsItemParams where Sys : WsSystem<Datas>
|
||||
{
|
||||
#pragma warning disable CS8603 // 可能返回 null 引用。
|
||||
var type_name = typeof(WsSystem<Datas>).FullName;
|
||||
if (type_name == null)
|
||||
throw new ArgumentException("类型名称为null");
|
||||
return _system_store[type_name] as WsSystem<Datas>;
|
||||
#pragma warning restore CS8603 // 可能返回 null 引用。
|
||||
}
|
||||
|
||||
public void RegisterSystem<Datas>(WsSystem<Datas> inst) where Datas : WsItemParams
|
||||
{
|
||||
#pragma warning disable CS8604 // 引用类型参数可能为 null。
|
||||
_system_store[typeof(WsSystem<Datas>).FullName] = inst;
|
||||
#pragma warning restore CS8604 // 引用类型参数可能为 null。
|
||||
}
|
||||
|
||||
private List<WsExecutableSystem> ExecutableSystemList
|
||||
{
|
||||
get
|
||||
{
|
||||
var items = from n in _system_store.Values
|
||||
orderby n.Name
|
||||
where n is WsExecutableSystem
|
||||
select n as WsExecutableSystem;
|
||||
return items.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
private List<Tuple<WsExecutableSystem, UInt128>> execute_list = new List<Tuple<WsExecutableSystem, UInt128>>();
|
||||
public void LoopRun()
|
||||
{
|
||||
var task_list = ExecutableSystemList;
|
||||
foreach (var t in task_list)
|
||||
{
|
||||
execute_list.Add(new Tuple<WsExecutableSystem, UInt128>(t, 0));
|
||||
}
|
||||
|
||||
for (; ; )
|
||||
{
|
||||
var unit = execute_list.ElementAt(0);
|
||||
unit.Item1.Run(this, unit.Item2);
|
||||
execute_list.RemoveAt(0);
|
||||
|
||||
bool find_flags = false;
|
||||
var next_time = unit.Item2 + unit.Item1.ExecutePeriodMsec;
|
||||
for (var tidx = 0; tidx < execute_list.Count; ++tidx)
|
||||
{
|
||||
var item = execute_list.ElementAt(tidx);
|
||||
|
||||
if (next_time < item.Item2)
|
||||
{
|
||||
execute_list.Insert(tidx, new Tuple<WsExecutableSystem, UInt128>(unit.Item1, next_time));
|
||||
find_flags = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!find_flags)
|
||||
{
|
||||
execute_list.Add(new Tuple<WsExecutableSystem, UInt128>(unit.Item1, next_time));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ExampleEntity : WsEntity, ShapeVolumeParams, MovementParam, MassFosterParams, LifetimeParams
|
||||
{
|
||||
public string TypeName { get; set; } = "示例实体";
|
||||
public UInt128 RuntimeID { get; set; } = 1;
|
||||
public string JsonContent { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
|
||||
public bool IsConsumed { get; set; } = true;
|
||||
public double AbsorbAmount { get; set; } = 0;
|
||||
public double MassInput { get; set; } = 0;
|
||||
public VariableDouble MassConvRates { get; } = new VariableDouble("重量转换效率", 0.0001);
|
||||
|
||||
|
||||
public List<VariableVal> TotalVariables { get; } = new List<VariableVal>();
|
||||
public WsBaseSystem? BindSystem { get; set; } = null;
|
||||
public WsEntity BindEntity => this;
|
||||
|
||||
public Vector3 PosXYZ { get; set; } = new Vector3();
|
||||
public Vector3 OritXYZ { get; set; } = new Vector3(1, 0, 0);
|
||||
public float Speed { get; set; } = 0.01f;
|
||||
public double Length { get; set; }
|
||||
public double Width { get; set; }
|
||||
public double Height { get; set; }
|
||||
private VariableDouble volume_current = new VariableDouble("", 0, 0, double.MaxValue / 2);
|
||||
public double Volume { get { return volume_current.Value; } set { volume_current.Value = value; } }
|
||||
|
||||
public VariableDouble PrimitiveLength { get; } = new VariableDouble("初生体长", 1);
|
||||
public VariableDouble PrimitiveWidth { get; } = new VariableDouble("初生体宽", 0.5);
|
||||
public VariableDouble PrimitiveHeight { get; } = new VariableDouble("初生体高", 0.5);
|
||||
|
||||
public VariableDouble Density { get; set; } = new VariableDouble("生体密度", 1);
|
||||
public UInt128 SpawnStart { get; set; }
|
||||
public UInt128 LifetimeAcc { get; set; }
|
||||
public double MatureVolume { get; set; } = -1;
|
||||
|
||||
public VariableULong GrowthTimeCount { get; } = new VariableULong("成长期长度", 1_000_000);
|
||||
public VariableULong MatureTimeCount { get; } = new VariableULong("成熟期长度", 100_000_000_000);
|
||||
public VariableULong DeathTimePoint { get; } = new VariableULong("死亡时间点", 120_000_000_000);
|
||||
public VariableULong SpawnPeriods { get; } = new VariableULong("繁育周期", 100_000);
|
||||
|
||||
public uint SpawnTimes { get; set; } = 0;
|
||||
|
||||
public VariablePercent ImpressRates { get; } = new VariablePercent("能量吸收转换效率", 0.1);
|
||||
|
||||
public void ActiveConfigBeforeExecute(WsSystemHost host)
|
||||
{
|
||||
var mass_sys = host.GetSystem<MassFosterParams, EnvFosterSystem>();
|
||||
var vol_sys = host.GetSystem<ShapeVolumeParams, ShapeVolumeSystem>();
|
||||
var mov_sys = host.GetSystem<MovementParam, MovementSystem>();
|
||||
var spawn_sys = host.GetSystem<LifetimeParams, LifetimeSystem>();
|
||||
|
||||
mass_sys.RegisterItem(this);
|
||||
vol_sys.RegisterItem(this);
|
||||
mov_sys.RegisterItem(this);
|
||||
spawn_sys.RegisterItem(this);
|
||||
|
||||
Console.WriteLine($"实体诞生:ID={RuntimeID}");
|
||||
}
|
||||
|
||||
public void DeathExecute(WsSystemHost host)
|
||||
{
|
||||
var mass_sys = host.GetSystem<MassFosterParams, EnvFosterSystem>();
|
||||
var vol_sys = host.GetSystem<ShapeVolumeParams, ShapeVolumeSystem>();
|
||||
var mov_sys = host.GetSystem<MovementParam, MovementSystem>();
|
||||
var spawn_sys = host.GetSystem<LifetimeParams, LifetimeSystem>();
|
||||
|
||||
mass_sys.RemoveItem(this.RuntimeID);
|
||||
vol_sys.RemoveItem(this.RuntimeID);
|
||||
mov_sys.RemoveItem(this.RuntimeID);
|
||||
spawn_sys.RemoveItem(this.RuntimeID);
|
||||
|
||||
Console.WriteLine($"实体死亡:ID={RuntimeID}");
|
||||
}
|
||||
|
||||
public ExampleEntity(UInt128 runtime_id)
|
||||
{
|
||||
this.RuntimeID = runtime_id;
|
||||
TotalVariables.Add(MassConvRates);
|
||||
TotalVariables.Add(PrimitiveLength);
|
||||
TotalVariables.Add(PrimitiveWidth);
|
||||
TotalVariables.Add(PrimitiveHeight);
|
||||
TotalVariables.Add(Density);
|
||||
TotalVariables.Add(GrowthTimeCount);
|
||||
TotalVariables.Add(MatureTimeCount);
|
||||
TotalVariables.Add(DeathTimePoint);
|
||||
TotalVariables.Add(SpawnPeriods);
|
||||
|
||||
Length = PrimitiveLength.Value;
|
||||
Width = PrimitiveWidth.Value;
|
||||
Height = PrimitiveHeight.Value;
|
||||
Volume = Length * Width * Height;
|
||||
}
|
||||
|
||||
public WsEntity NewEmpty(UInt128 id)
|
||||
{
|
||||
return new ExampleEntity(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,169 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ShapeVolume;
|
||||
using SharpWorld;
|
||||
using Variables;
|
||||
|
||||
namespace EntitySpawn
|
||||
{
|
||||
public interface LifetimeParams : WsItemParams
|
||||
{
|
||||
/// <summary>
|
||||
/// 诞生时间点
|
||||
/// </summary>
|
||||
UInt128 SpawnStart { get; set; }
|
||||
/// <summary>
|
||||
/// 寿命长度累计
|
||||
/// </summary>
|
||||
UInt128 LifetimeAcc { get; set; }
|
||||
/// <summary>
|
||||
/// 成熟体最小质量
|
||||
/// </summary>
|
||||
double MatureVolume { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 成长期长度
|
||||
/// </summary>
|
||||
VariableULong GrowthTimeCount { get; }
|
||||
/// <summary>
|
||||
/// 壮年期长度
|
||||
/// </summary>
|
||||
VariableULong MatureTimeCount { get; }
|
||||
/// <summary>
|
||||
/// 死亡时间点
|
||||
/// </summary>
|
||||
VariableULong DeathTimePoint { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 繁育周期
|
||||
/// </summary>
|
||||
VariableULong SpawnPeriods { get; }
|
||||
/// <summary>
|
||||
/// 繁育次数
|
||||
/// </summary>
|
||||
UInt32 SpawnTimes { get; set; }
|
||||
}
|
||||
|
||||
public class LifetimeSystem : WsSystem<LifetimeParams>, WsExecutableSystem
|
||||
{
|
||||
private Dictionary<UInt128, LifetimeParams> _items_store = new Dictionary<UInt128, LifetimeParams>();
|
||||
|
||||
public uint ExecutePeriodMsec => 1000;
|
||||
|
||||
public string Name => "生命周期控制系统";
|
||||
|
||||
public LifetimeParams GetItem(UInt128 RtID)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
return _items_store[RtID];
|
||||
}
|
||||
}
|
||||
|
||||
public void RegisterItem(LifetimeParams entity_params)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
_items_store[entity_params.BindEntity.RuntimeID] = entity_params;
|
||||
}
|
||||
}
|
||||
|
||||
private void spawn_update(WsSystemHost host, LifetimeParams it, UInt128 current_timepoint)
|
||||
{
|
||||
var timepoint_birth = it.SpawnStart;
|
||||
var growth_span = current_timepoint - timepoint_birth;
|
||||
it.LifetimeAcc = growth_span;
|
||||
|
||||
// 成长期不繁育
|
||||
if (it.LifetimeAcc <= it.GrowthTimeCount.Value)
|
||||
return;
|
||||
|
||||
// 死亡移除
|
||||
if (it.LifetimeAcc >= it.DeathTimePoint.Value)
|
||||
{
|
||||
it.BindEntity.DeathExecute(host);
|
||||
return;
|
||||
}
|
||||
|
||||
// 记录成熟期初始体积
|
||||
if (it.MatureVolume <= 0)
|
||||
{
|
||||
var vol_sys = host.GetSystem<ShapeVolumeParams, ShapeVolumeSystem>();
|
||||
var vol_param = vol_sys.GetItem(it.BindEntity.RuntimeID);
|
||||
var birth_volume = vol_param.PrimitiveHeight.Value * vol_param.PrimitiveWidth.Value * vol_param.PrimitiveLength.Value;
|
||||
|
||||
if (vol_param.Volume > birth_volume * 20000)
|
||||
{
|
||||
it.MatureVolume = birth_volume * 20000;
|
||||
}
|
||||
else
|
||||
{
|
||||
it.MatureVolume = vol_param.Volume;
|
||||
}
|
||||
}
|
||||
|
||||
// 成熟期开始生育
|
||||
if (it.LifetimeAcc <= it.GrowthTimeCount.Value + it.MatureTimeCount.Value)
|
||||
{
|
||||
// 执行生育计算
|
||||
var span = it.LifetimeAcc - it.GrowthTimeCount.Value;
|
||||
if (it.SpawnTimes < (span / it.SpawnPeriods.Value))
|
||||
{
|
||||
var vol_sys = host.GetSystem<ShapeVolumeParams, ShapeVolumeSystem>();
|
||||
var vol_param = vol_sys.GetItem(it.BindEntity.RuntimeID);
|
||||
|
||||
var current_volume = vol_param.Volume;
|
||||
var volume_redundance = current_volume - it.MatureVolume;
|
||||
volume_redundance -= Math.Pow(volume_redundance, 0.75);
|
||||
var birth_volume = vol_param.PrimitiveHeight.Value * vol_param.PrimitiveWidth.Value * vol_param.PrimitiveLength.Value;
|
||||
|
||||
// 纠正繁育周期错误
|
||||
if (volume_redundance < birth_volume)
|
||||
{
|
||||
var xval = it.SpawnPeriods.Value * 2;
|
||||
it.SpawnPeriods.Value = xval;
|
||||
return;
|
||||
}
|
||||
|
||||
// 执行繁育
|
||||
it.SpawnTimes++;
|
||||
var spawn_count = (UInt128)(volume_redundance / birth_volume);
|
||||
Console.WriteLine($"繁育时间:time={current_timepoint}");
|
||||
for (UInt128 idx = 0; idx < spawn_count; ++idx)
|
||||
{
|
||||
var new_entity = it.BindEntity.NewEmpty(host.AllocNewID());
|
||||
new_entity.ActiveConfigBeforeExecute(host);
|
||||
current_volume -= birth_volume;
|
||||
}
|
||||
|
||||
// 校正体积
|
||||
var times = Math.Pow(current_volume / birth_volume, 1 / 3.0);
|
||||
vol_param.Length = times * vol_param.PrimitiveLength.Value;
|
||||
vol_param.Width = times * vol_param.PrimitiveWidth.Value;
|
||||
vol_param.Height = times * vol_param.PrimitiveHeight.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void Run(WsSystemHost host, UInt128 timepoint_msec)
|
||||
{
|
||||
var srcl = _items_store.Values.ToList();
|
||||
var opts = new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount };
|
||||
Parallel.For(0, srcl.Count, opts, index =>
|
||||
{
|
||||
var it = srcl[index];
|
||||
spawn_update(host, it, timepoint_msec);
|
||||
});
|
||||
}
|
||||
|
||||
public void RemoveItem(UInt128 RtID)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
_items_store.Remove(RtID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ShapeVolume;
|
||||
using SharpWorld;
|
||||
using Variables;
|
||||
|
||||
namespace MassFoster
|
||||
{
|
||||
public interface MassFosterParams : WsItemParams
|
||||
{
|
||||
bool IsConsumed { get; set; }
|
||||
|
||||
double AbsorbAmount { get; set; }
|
||||
double MassInput { get; set; }
|
||||
/// <summary>
|
||||
/// 光合作用转换效率
|
||||
/// </summary>
|
||||
VariableDouble MassConvRates { get; }
|
||||
}
|
||||
|
||||
public class EnvFosterSystem : WsSystem<MassFosterParams>, WsExecutableSystem
|
||||
{
|
||||
private Dictionary<UInt128, MassFosterParams> _items_store = new Dictionary<UInt128, MassFosterParams>();
|
||||
|
||||
public string Name => "环境能量养护系统";
|
||||
|
||||
public uint ExecutePeriodMsec => 1000;
|
||||
|
||||
public MassFosterParams GetItem(UInt128 RtID)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
return _items_store[RtID];
|
||||
}
|
||||
}
|
||||
|
||||
public void RegisterItem(MassFosterParams entity_params)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
_items_store[entity_params.BindEntity.RuntimeID] = entity_params;
|
||||
}
|
||||
}
|
||||
|
||||
private void update_batch(WsSystemHost host, MassFosterParams item)
|
||||
{
|
||||
var volsys = host.GetSystem<ShapeVolumeParams, ShapeVolumeSystem>();
|
||||
var volparam = volsys.GetItem(item.BindEntity.RuntimeID);
|
||||
var square = volparam.Length * volparam.Width;
|
||||
|
||||
if (item.IsConsumed)
|
||||
{
|
||||
item.IsConsumed = false;
|
||||
item.AbsorbAmount = 0;
|
||||
item.MassInput = 0;
|
||||
}
|
||||
|
||||
item.AbsorbAmount += _energy_density * square;
|
||||
var new_mass = item.AbsorbAmount * item.MassConvRates.Value;
|
||||
item.MassInput = new_mass;
|
||||
}
|
||||
|
||||
public void Run(WsSystemHost host, UInt128 timepoint)
|
||||
{
|
||||
var srcl = _items_store.Values.ToList();
|
||||
var opts = new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount };
|
||||
Parallel.For(0, srcl.Count, opts, index => {
|
||||
var param = srcl[index];
|
||||
update_batch(host, param);
|
||||
});
|
||||
}
|
||||
|
||||
public void RemoveItem(UInt128 RtID)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
_items_store.Remove(RtID);
|
||||
}
|
||||
}
|
||||
|
||||
//=========================
|
||||
/// <summary>
|
||||
/// 表面能量密度
|
||||
/// </summary>
|
||||
private double _energy_density = 0;
|
||||
/// <summary>
|
||||
/// 构建能量消耗计算系统
|
||||
/// </summary>
|
||||
/// <param name="plain_energy"></param>
|
||||
public EnvFosterSystem(double plain_energy)
|
||||
{
|
||||
_energy_density = plain_energy;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
using SharpWorld;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Movement
|
||||
{
|
||||
public interface MovementParam : WsItemParams
|
||||
{
|
||||
public Vector3 PosXYZ { get; set; }
|
||||
public Vector3 OritXYZ { get; set; }
|
||||
|
||||
public float Speed { get; set; }
|
||||
}
|
||||
|
||||
public class MovementSystem : WsSystem<MovementParam>, SharpWorld.WsExecutableSystem
|
||||
{
|
||||
private Dictionary<UInt128, MovementParam> _items_store = new Dictionary<UInt128, MovementParam>();
|
||||
|
||||
public string Name => "机动演算系统";
|
||||
|
||||
public uint ExecutePeriodMsec => 100;
|
||||
|
||||
public MovementParam GetItem(UInt128 RtID)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
return _items_store[RtID];
|
||||
}
|
||||
}
|
||||
|
||||
public void RegisterItem(MovementParam entity_params)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
_items_store[entity_params.BindEntity.RuntimeID] = entity_params;
|
||||
}
|
||||
}
|
||||
|
||||
public void movement_update(WsSystemHost host, MovementParam item_ps)
|
||||
{
|
||||
var orit_vec = Vector3.Normalize(item_ps.OritXYZ);
|
||||
var move_span = Vector3.Multiply(orit_vec, item_ps.Speed);
|
||||
item_ps.PosXYZ = Vector3.Add(item_ps.PosXYZ, move_span);
|
||||
}
|
||||
|
||||
public void Run(WsSystemHost host, UInt128 timepoint)
|
||||
{
|
||||
var srcl = _items_store.Values.ToList();
|
||||
var opts = new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount };
|
||||
Parallel.For(0, srcl.Count, opts, index => {
|
||||
var it = srcl[index];
|
||||
movement_update(host, it);
|
||||
});
|
||||
}
|
||||
|
||||
public void RemoveItem(UInt128 RtID)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
_items_store.Remove(RtID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
using MassFoster;
|
||||
using ShapeVolume;
|
||||
using Movement;
|
||||
using SharpWorld;
|
||||
using CoreImplement;
|
||||
using EntitySpawn;
|
||||
|
||||
class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var host = new SystemHost();
|
||||
|
||||
host.RegisterSystem(new EnvFosterSystem(2));
|
||||
host.RegisterSystem(new ShapeVolumeSystem());
|
||||
host.RegisterSystem(new MovementSystem());
|
||||
host.RegisterSystem(new LifetimeSystem());
|
||||
|
||||
var entity_inst = new ExampleEntity(1);
|
||||
entity_inst.ActiveConfigBeforeExecute(host);
|
||||
|
||||
host.LoopRun();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using MassFoster;
|
||||
using SharpWorld;
|
||||
using Variables;
|
||||
|
||||
namespace ShapeVolume
|
||||
{
|
||||
public interface ShapeVolumeParams : WsItemParams
|
||||
{
|
||||
public double Length { get; set; }
|
||||
public double Width { get; set; }
|
||||
public double Height { get; set; }
|
||||
public double Volume { get; set; }
|
||||
|
||||
public VariableDouble PrimitiveLength { get; }
|
||||
public VariableDouble PrimitiveWidth { get; }
|
||||
public VariableDouble PrimitiveHeight { get; }
|
||||
public VariableDouble Density { get; }
|
||||
|
||||
public VariablePercent ImpressRates { get; }
|
||||
}
|
||||
|
||||
public class ShapeVolumeSystem : WsExecutableSystem, WsSystem<ShapeVolumeParams>
|
||||
{
|
||||
private Dictionary<UInt128, ShapeVolumeParams> _items_store = new Dictionary<UInt128, ShapeVolumeParams>();
|
||||
|
||||
public uint ExecutePeriodMsec => 10_000;
|
||||
|
||||
public string Name => "体重演算系统";
|
||||
|
||||
public ShapeVolumeParams GetItem(UInt128 RtID)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
return _items_store[RtID];
|
||||
}
|
||||
}
|
||||
|
||||
public void RegisterItem(ShapeVolumeParams entity_params)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
_items_store[entity_params.BindEntity.RuntimeID] = entity_params;
|
||||
}
|
||||
}
|
||||
|
||||
private void update_volumes(WsSystemHost host, ShapeVolumeParams vmit)
|
||||
{
|
||||
var mass_sys = host.GetSystem<MassFosterParams, EnvFosterSystem>();
|
||||
|
||||
var mass_param = mass_sys.GetItem(vmit.BindEntity.RuntimeID);
|
||||
mass_param.IsConsumed = true;
|
||||
var m_new = mass_param.MassInput;
|
||||
var vol_new = m_new / vmit.Density.Value * vmit.ImpressRates.Value;
|
||||
vmit.Volume += vol_new;
|
||||
|
||||
var primitive_vol = vmit.PrimitiveHeight.Value * vmit.PrimitiveLength.Value * vmit.PrimitiveWidth.Value;
|
||||
var times = Math.Pow(vmit.Volume / primitive_vol, 1 / 3.0);
|
||||
vmit.Length = times * vmit.PrimitiveLength.Value;
|
||||
vmit.Width = times * vmit.PrimitiveWidth.Value;
|
||||
vmit.Height = times * vmit.PrimitiveHeight.Value;
|
||||
}
|
||||
|
||||
public void Run(WsSystemHost host, UInt128 timepoint_msec)
|
||||
{
|
||||
var srcl = _items_store.Values.ToList();
|
||||
var opts = new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount };
|
||||
Parallel.For(0, srcl.Count, opts, index => {
|
||||
var it = srcl[index];
|
||||
update_volumes(host, it);
|
||||
});
|
||||
}
|
||||
|
||||
public void RemoveItem(UInt128 RtID)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
_items_store.Remove(RtID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,154 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SharpWorld
|
||||
{
|
||||
/// <summary>
|
||||
/// 可变参数类型共同接口
|
||||
/// </summary>
|
||||
public interface VariableVal {
|
||||
/// <summary>
|
||||
/// 参数名称
|
||||
/// </summary>
|
||||
string Name { get; }
|
||||
/// <summary>
|
||||
/// 以指定比率执行变异
|
||||
/// </summary>
|
||||
/// <param name="rates">变异比率</param>
|
||||
void Variation(double rates);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 参与系统运算的个体数据
|
||||
/// </summary>
|
||||
public interface WsItemParams {
|
||||
/// <summary>
|
||||
/// 获取所有可变异参数
|
||||
/// </summary>
|
||||
List<VariableVal> TotalVariables { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 运行时绑定特性演算系统
|
||||
/// </summary>
|
||||
WsBaseSystem? BindSystem { get; set; }
|
||||
/// <summary>
|
||||
/// 绑定实体
|
||||
/// </summary>
|
||||
WsEntity BindEntity { get; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 增强特性运行系统
|
||||
/// </summary>
|
||||
public interface WsBaseSystem {
|
||||
/// <summary>
|
||||
/// 系统组件名称
|
||||
/// </summary>
|
||||
string Name { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 可运行系统
|
||||
/// </summary>
|
||||
public interface WsExecutableSystem : WsBaseSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// 执行周期(以毫秒计)
|
||||
/// </summary>
|
||||
UInt32 ExecutePeriodMsec { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 执行方法
|
||||
/// <param name="host">host系统实例</param>
|
||||
/// <param name="timepoint_msec">当前仿真时间点,毫秒计</param>
|
||||
/// </summary>
|
||||
void Run(WsSystemHost host, UInt128 timepoint_msec);
|
||||
}
|
||||
|
||||
public interface WsSystem<Datas> : WsBaseSystem
|
||||
where Datas : WsItemParams
|
||||
{
|
||||
/// <summary>
|
||||
/// 在系统内注册实体参数
|
||||
/// </summary>
|
||||
/// <typeparam name="Datas">参数类型</typeparam>
|
||||
/// <param name="entity_params">参数实例</param>
|
||||
void RegisterItem(Datas entity_params);
|
||||
|
||||
/// <summary>
|
||||
/// 移除实体
|
||||
/// </summary>
|
||||
/// <param name="RtID"></param>
|
||||
void RemoveItem(UInt128 RtID);
|
||||
|
||||
/// <summary>
|
||||
/// 通过实体id获取在此系统中绑定的参数包
|
||||
/// </summary>
|
||||
/// <param name="RtID"></param>
|
||||
/// <returns></returns>
|
||||
Datas GetItem(UInt128 RtID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 系统访问管理接口
|
||||
/// </summary>
|
||||
public interface WsSystemHost
|
||||
{
|
||||
/// <summary>
|
||||
/// 下一个实体的id
|
||||
/// </summary>
|
||||
public UInt128 AllocNewID();
|
||||
|
||||
/// <summary>
|
||||
/// 注册可以执行的系统
|
||||
/// </summary>
|
||||
/// <param name="inst"></param>
|
||||
void RegisterSystem<Datas>(WsSystem<Datas> inst) where Datas : WsItemParams;
|
||||
|
||||
/// <summary>
|
||||
/// 通过类型获取系统实例
|
||||
/// </summary>
|
||||
/// <typeparam name="Sys">系统类型</typeparam>
|
||||
/// <returns></returns>
|
||||
WsSystem<Datas> GetSystem<Datas, Sys>() where Datas : WsItemParams where Sys: WsSystem<Datas>;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 实体
|
||||
/// </summary>
|
||||
public interface WsEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 创建一个空实例
|
||||
/// </summary>
|
||||
/// <param name="new_id">实体id</param>
|
||||
/// <returns>空实例</returns>
|
||||
WsEntity NewEmpty(UInt128 new_id);
|
||||
|
||||
/// <summary>
|
||||
/// 实体类型
|
||||
/// </summary>
|
||||
string TypeName { get; set; }
|
||||
/// <summary>
|
||||
/// 运行时id
|
||||
/// </summary>
|
||||
UInt128 RuntimeID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 在系统运行前执行动态配置
|
||||
/// </summary>
|
||||
/// <param name="host"></param>
|
||||
void ActiveConfigBeforeExecute(WsSystemHost host);
|
||||
void DeathExecute(WsSystemHost host);
|
||||
|
||||
/// <summary>
|
||||
/// 存取序列化Json内容
|
||||
/// </summary>
|
||||
string JsonContent { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,114 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Variables
|
||||
{
|
||||
public abstract class VariableData<D> : SharpWorld.VariableVal
|
||||
where D : struct
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
private D value_store;
|
||||
public virtual D Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return value_store;
|
||||
}
|
||||
set
|
||||
{
|
||||
value_store = value;
|
||||
}
|
||||
}
|
||||
|
||||
public VariableData(string name)
|
||||
{
|
||||
this.Name = name;
|
||||
}
|
||||
|
||||
public abstract void Variation(double rates);
|
||||
}
|
||||
|
||||
public class VariableDouble : VariableData<Double>
|
||||
{
|
||||
public double Min { get; set; } = -Double.MaxValue;
|
||||
public double Max { get; set; } = Double.MaxValue;
|
||||
|
||||
public VariableDouble(string name) : base(name) { }
|
||||
public VariableDouble(string name, double val) : base(name) { Value = val; }
|
||||
public VariableDouble(string name, double val, double min, double max)
|
||||
: base(name)
|
||||
{
|
||||
Value = val;
|
||||
Min = min;
|
||||
Max = max;
|
||||
}
|
||||
|
||||
public override double Value
|
||||
{
|
||||
get { return base.Value; }
|
||||
set
|
||||
{
|
||||
base.Value = Math.Max(Min, Math.Min(Max, value));
|
||||
}
|
||||
}
|
||||
|
||||
public override void Variation(double rates)
|
||||
{
|
||||
var dtinst = DateTime.Now.Millisecond;
|
||||
var flag = dtinst % 2;
|
||||
Value *= (1 + Math.Pow(-1, flag) * rates);
|
||||
}
|
||||
}
|
||||
|
||||
public class VariablePercent : VariableDouble
|
||||
{
|
||||
public VariablePercent(string name) : base(name) { }
|
||||
public VariablePercent(string name, double val) : base(name, val)
|
||||
{
|
||||
Value = val;
|
||||
}
|
||||
|
||||
public override double Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Value = Math.Min(1, Math.Max(0, value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class VariableInt : VariableData<int>
|
||||
{
|
||||
public VariableInt(string name) : base(name) { }
|
||||
|
||||
public override void Variation(double rates)
|
||||
{
|
||||
var dtinst = DateTime.Now.Millisecond;
|
||||
var flag = dtinst % 2;
|
||||
var temp_val = Value * (1 + Math.Pow(-1, flag) * rates);
|
||||
Value = (int)temp_val;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class VariableULong : VariableData<UInt64>
|
||||
{
|
||||
public VariableULong(string name, ulong val) : base(name) { Value = val; }
|
||||
|
||||
public override void Variation(double rates)
|
||||
{
|
||||
var dtinst = DateTime.Now.Millisecond;
|
||||
var flag = dtinst % 2;
|
||||
var temp_val = Value * (1 + Math.Pow(-1, flag) * rates);
|
||||
Value = (UInt64)temp_val;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue