init
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
namespace GeometryTD.DataTable
|
||||
{
|
||||
public static class BinaryReaderExtension
|
||||
{
|
||||
public static Color32 ReadColor32(this BinaryReader binaryReader)
|
||||
{
|
||||
return new Color32(binaryReader.ReadByte(), binaryReader.ReadByte(), binaryReader.ReadByte(), binaryReader.ReadByte());
|
||||
}
|
||||
|
||||
public static Color ReadColor(this BinaryReader binaryReader)
|
||||
{
|
||||
return new Color(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle());
|
||||
}
|
||||
|
||||
public static DateTime ReadDateTime(this BinaryReader binaryReader)
|
||||
{
|
||||
return new DateTime(binaryReader.ReadInt64());
|
||||
}
|
||||
|
||||
public static Quaternion ReadQuaternion(this BinaryReader binaryReader)
|
||||
{
|
||||
return new Quaternion(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle());
|
||||
}
|
||||
|
||||
public static Rect ReadRect(this BinaryReader binaryReader)
|
||||
{
|
||||
return new Rect(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle());
|
||||
}
|
||||
|
||||
public static Vector2 ReadVector2(this BinaryReader binaryReader)
|
||||
{
|
||||
return new Vector2(binaryReader.ReadSingle(), binaryReader.ReadSingle());
|
||||
}
|
||||
|
||||
public static Vector3 ReadVector3(this BinaryReader binaryReader)
|
||||
{
|
||||
return new Vector3(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle());
|
||||
}
|
||||
|
||||
public static Vector4 ReadVector4(this BinaryReader binaryReader)
|
||||
{
|
||||
return new Vector4(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
using System;
|
||||
using GeometryTD.Definition;
|
||||
using GeometryTD.CustomUtility;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace GeometryTD.DataTable
|
||||
{
|
||||
/// <summary>
|
||||
/// 底座组件表
|
||||
/// </summary>
|
||||
public class DRBaseComp : DataRowBase
|
||||
{
|
||||
private int m_Id = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取底座组件编号
|
||||
/// </summary>
|
||||
public override int Id => m_Id;
|
||||
|
||||
/// <summary>
|
||||
/// 获取底座组件名
|
||||
/// </summary>
|
||||
public string Name { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取底座组件攻击速度数组(秒/次)
|
||||
/// </summary>
|
||||
public float[] AttackSpeed { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取底座组件每级提升攻击速度(值为负数)
|
||||
/// </summary>
|
||||
public float AttackSpeedPerLevel { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取攻击属性
|
||||
/// </summary>
|
||||
public AttackPropertyType AttackPropertyType { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取属性约束
|
||||
/// </summary>
|
||||
public string Constraint { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取可能出现的 Tag
|
||||
/// </summary>
|
||||
public TagType[] PossibleTag { get; private set; }
|
||||
|
||||
public override bool ParseDataRow(string dataRowString, object userData)
|
||||
{
|
||||
string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);
|
||||
for (int i = 0; i < columnStrings.Length; i++)
|
||||
{
|
||||
columnStrings[i] = columnStrings[i].Trim(DataTableExtension.DataTrimSeparators);
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
index++;
|
||||
m_Id = int.Parse(columnStrings[index++]);
|
||||
index++;
|
||||
Name = columnStrings[index++];
|
||||
AttackSpeed = GenerateAttackSpeed(columnStrings[index++]);
|
||||
AttackSpeedPerLevel = float.Parse(columnStrings[index++]);
|
||||
AttackPropertyType = EnumUtility<AttackPropertyType>.Get(columnStrings[index++]);
|
||||
Constraint = columnStrings[index++];
|
||||
PossibleTag = GeneratePossibleTag(columnStrings[index++]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private float[] GenerateAttackSpeed(string raw)
|
||||
{
|
||||
if (!raw.StartsWith('[') || !raw.EndsWith(']'))
|
||||
{
|
||||
throw new ArgumentException("Input must be enclosed in square brackets.");
|
||||
}
|
||||
|
||||
if (raw.Length == 2) return new float[] { };
|
||||
string[] attackSpeedRaws = raw.Substring(1, raw.Length - 2).Split(",");
|
||||
int length = attackSpeedRaws.Length;
|
||||
var attackSpeed = new float[length];
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
attackSpeed[i] = float.Parse(attackSpeedRaws[i]);
|
||||
}
|
||||
|
||||
return attackSpeed;
|
||||
}
|
||||
|
||||
private TagType[] GeneratePossibleTag(string raw)
|
||||
{
|
||||
if (!raw.StartsWith('[') || !raw.EndsWith(']'))
|
||||
{
|
||||
throw new ArgumentException("Input must be enclosed in square brackets.");
|
||||
}
|
||||
|
||||
if (raw.Length == 2) return new TagType[] { };
|
||||
string[] tagTypes = raw.Substring(1, raw.Length - 2).Split(",");
|
||||
int length = tagTypes.Length;
|
||||
var tags = new TagType[length];
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
tags[i] = EnumUtility<TagType>.Get(tagTypes[i]);
|
||||
}
|
||||
|
||||
return tags;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
using System;
|
||||
using GeometryTD.Definition;
|
||||
using GeometryTD.CustomUtility;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace GeometryTD.DataTable
|
||||
{
|
||||
/// <summary>
|
||||
/// 轴承组件表
|
||||
/// </summary>
|
||||
public class DRBearingComp : DataRowBase
|
||||
{
|
||||
private int m_Id = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取轴承组件编号
|
||||
/// </summary>
|
||||
public override int Id => m_Id;
|
||||
|
||||
/// <summary>
|
||||
/// 获取轴承组件名
|
||||
/// </summary>
|
||||
public string Name { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取轴承组件旋转速度数组
|
||||
/// </summary>
|
||||
public float[] RotateSpeed { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取轴承组件每级提升旋转速度
|
||||
/// </summary>
|
||||
public float RotateSpeedPerLevel { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取攻击范围
|
||||
/// </summary>
|
||||
public float[] AttackRange { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取每级提升攻击范围
|
||||
/// </summary>
|
||||
public float AttackRangePerLevel { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取属性约束
|
||||
/// </summary>
|
||||
public string Constraint { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取可能出现的 Tag
|
||||
/// </summary>
|
||||
public TagType[] PossibleTag { get; private set; }
|
||||
|
||||
public override bool ParseDataRow(string dataRowString, object userData)
|
||||
{
|
||||
string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);
|
||||
for (int i = 0; i < columnStrings.Length; i++)
|
||||
{
|
||||
columnStrings[i] = columnStrings[i].Trim(DataTableExtension.DataTrimSeparators);
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
index++;
|
||||
m_Id = int.Parse(columnStrings[index++]);
|
||||
index++;
|
||||
Name = columnStrings[index++];
|
||||
RotateSpeed = GenerateFloatArray(columnStrings[index++]);
|
||||
RotateSpeedPerLevel = float.Parse(columnStrings[index++]);
|
||||
AttackRange = GenerateFloatArray(columnStrings[index++]);
|
||||
AttackRangePerLevel = float.Parse(columnStrings[index++]);
|
||||
Constraint = columnStrings[index++];
|
||||
PossibleTag = GeneratePossibleTag(columnStrings[index++]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private float[] GenerateFloatArray(string raw)
|
||||
{
|
||||
if (!raw.StartsWith('[') || !raw.EndsWith(']'))
|
||||
{
|
||||
throw new ArgumentException("Input must be enclosed in square brackets.");
|
||||
}
|
||||
|
||||
if (raw.Length == 2) return new float[] { };
|
||||
string[] raws = raw.Substring(1, raw.Length - 2).Split(",");
|
||||
int length = raws.Length;
|
||||
var array = new float[length];
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
array[i] = float.Parse(raws[i]);
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
private TagType[] GeneratePossibleTag(string raw)
|
||||
{
|
||||
if (!raw.StartsWith('[') || !raw.EndsWith(']'))
|
||||
{
|
||||
throw new ArgumentException("Input must be enclosed in square brackets.");
|
||||
}
|
||||
|
||||
if (raw.Length == 2) return new TagType[] { };
|
||||
string[] tagTypes = raw.Substring(1, raw.Length - 2).Split(",");
|
||||
int length = tagTypes.Length;
|
||||
var tags = new TagType[length];
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
tags[i] = EnumUtility<TagType>.Get(tagTypes[i]);
|
||||
}
|
||||
|
||||
return tags;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace GeometryTD.DataTable
|
||||
{
|
||||
/// <summary>
|
||||
/// 敌人配置表
|
||||
/// </summary>
|
||||
public class DREnemy : DataRowBase
|
||||
{
|
||||
private int m_Id = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取敌人编号
|
||||
/// </summary>
|
||||
public override int Id => m_Id;
|
||||
|
||||
/// <summary>
|
||||
/// 获取敌人实体编号
|
||||
/// </summary>
|
||||
public int EntityId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取敌人基础血量
|
||||
/// </summary>
|
||||
public int BaseHp { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取敌人基础基地伤害
|
||||
/// </summary>
|
||||
public int BaseDamage { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取敌人移动速度
|
||||
/// </summary>
|
||||
public float Speed { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取敌人掉落硬币
|
||||
/// </summary>
|
||||
public int DropCoin { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取敌人掉落金币
|
||||
/// </summary>
|
||||
public int DropGold { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取敌人掉落金币概率
|
||||
/// </summary>
|
||||
public float DropPercent { get; private set; }
|
||||
|
||||
public override bool ParseDataRow(string dataRowString, object userData)
|
||||
{
|
||||
string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);
|
||||
for (int i = 0; i < columnStrings.Length; i++)
|
||||
{
|
||||
columnStrings[i] = columnStrings[i].Trim(DataTableExtension.DataTrimSeparators);
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
index++;
|
||||
m_Id = int.Parse(columnStrings[index++]);
|
||||
index++;
|
||||
EntityId = int.Parse(columnStrings[index++]);
|
||||
BaseHp = int.Parse(columnStrings[index++]);
|
||||
BaseDamage = int.Parse(columnStrings[index++]);
|
||||
Speed = float.Parse(columnStrings[index++]);
|
||||
DropCoin = int.Parse(columnStrings[index++]);
|
||||
DropGold = int.Parse(columnStrings[index++]);
|
||||
DropPercent = float.Parse(columnStrings[index++]);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
// 此文件由工具自动生成,请勿直接修改。
|
||||
// 生成时间:2021-06-16 21:54:35.576
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace GeometryTD.DataTable
|
||||
{
|
||||
/// <summary>
|
||||
/// 实体表。
|
||||
/// </summary>
|
||||
public class DREntity : DataRowBase
|
||||
{
|
||||
private int m_Id = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取实体编号。
|
||||
/// </summary>
|
||||
public override int Id => m_Id;
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源名称。
|
||||
/// </summary>
|
||||
public string AssetName
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public override bool ParseDataRow(string dataRowString, object userData)
|
||||
{
|
||||
string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);
|
||||
for (int i = 0; i < columnStrings.Length; i++)
|
||||
{
|
||||
columnStrings[i] = columnStrings[i].Trim(DataTableExtension.DataTrimSeparators);
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
index++;
|
||||
m_Id = int.Parse(columnStrings[index++]);
|
||||
index++;
|
||||
AssetName = columnStrings[index++];
|
||||
|
||||
GeneratePropertyArray();
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool ParseDataRow(byte[] dataRowBytes, int startIndex, int length, object userData)
|
||||
{
|
||||
using (MemoryStream memoryStream = new MemoryStream(dataRowBytes, startIndex, length, false))
|
||||
{
|
||||
using (BinaryReader binaryReader = new BinaryReader(memoryStream, Encoding.UTF8))
|
||||
{
|
||||
m_Id = binaryReader.Read7BitEncodedInt32();
|
||||
AssetName = binaryReader.ReadString();
|
||||
}
|
||||
}
|
||||
|
||||
GeneratePropertyArray();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void GeneratePropertyArray()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
using UnityGameFramework.Runtime;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace GeometryTD.DataTable
|
||||
{
|
||||
/// <summary>
|
||||
/// 事件配置表
|
||||
/// </summary>
|
||||
public class DREvent : DataRowBase
|
||||
{
|
||||
private int m_Id = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取事件编号
|
||||
/// </summary>
|
||||
public override int Id => m_Id;
|
||||
|
||||
/// <summary>
|
||||
/// 获取事件题目
|
||||
/// </summary>
|
||||
public string Title { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取事件描述
|
||||
/// </summary>
|
||||
public string Description { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取事件选项
|
||||
/// </summary>
|
||||
/// <remarks>原始字符串(如 JSON 文本),不在此处做解析。</remarks>
|
||||
public string OptionsRaw { get; private set; }
|
||||
|
||||
public string Option1Raw { get; private set; }
|
||||
|
||||
public string Option2Raw { get; private set; }
|
||||
|
||||
public string Option3Raw { get; private set; }
|
||||
|
||||
public string Option4Raw { get; private set; }
|
||||
|
||||
public override bool ParseDataRow(string dataRowString, object userData)
|
||||
{
|
||||
string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);
|
||||
for (int i = 0; i < columnStrings.Length; i++)
|
||||
{
|
||||
columnStrings[i] = columnStrings[i].Trim(DataTableExtension.DataTrimSeparators);
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
index++;
|
||||
m_Id = int.Parse(columnStrings[index++]);
|
||||
index++;
|
||||
Title = columnStrings[index++];
|
||||
Description = columnStrings[index++];
|
||||
Option1Raw = columnStrings[index++];
|
||||
Option2Raw = columnStrings[index++];
|
||||
Option3Raw = columnStrings[index++];
|
||||
Option4Raw = columnStrings[index++];
|
||||
OptionsRaw = BuildOptionsRaw(Option1Raw, Option2Raw, Option3Raw, Option4Raw);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static string BuildOptionsRaw(params string[] optionColumns)
|
||||
{
|
||||
JArray array = new JArray();
|
||||
for (int i = 0; i < optionColumns.Length; i++)
|
||||
{
|
||||
string optionRaw = optionColumns[i];
|
||||
if (string.IsNullOrWhiteSpace(optionRaw))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
array.Add(JObject.Parse(optionRaw));
|
||||
}
|
||||
|
||||
return array.ToString(Newtonsoft.Json.Formatting.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using GeometryTD.Definition;
|
||||
using GeometryTD.CustomUtility;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace GeometryTD.DataTable
|
||||
{
|
||||
/// <summary>
|
||||
/// 关卡表
|
||||
/// </summary>
|
||||
public class DRLevel : DataRowBase
|
||||
{
|
||||
private int m_Id = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取关卡编号
|
||||
/// </summary>
|
||||
public override int Id => m_Id;
|
||||
|
||||
/// <summary>
|
||||
/// 获取关卡所属主题类型
|
||||
/// </summary>
|
||||
public LevelThemeType LevelThemeType { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取关卡初始基地生命
|
||||
/// </summary>
|
||||
public int BaseHp { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取关卡初始硬币数量
|
||||
/// </summary>
|
||||
public int StartCoin { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取关卡胜利条件
|
||||
/// </summary>
|
||||
public LevelVictoryType LevelVictoryType { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取关卡胜利奖励金币
|
||||
/// </summary>
|
||||
public int RewardGold { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取关卡胜利条件参数
|
||||
/// </summary>
|
||||
public string VictoryParams { get; private set; }
|
||||
|
||||
public override bool ParseDataRow(string dataRowString, object userData)
|
||||
{
|
||||
string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);
|
||||
for (int i = 0; i < columnStrings.Length; i++)
|
||||
{
|
||||
columnStrings[i] = columnStrings[i].Trim(DataTableExtension.DataTrimSeparators);
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
index++;
|
||||
m_Id = int.Parse(columnStrings[index++]);
|
||||
index++;
|
||||
LevelThemeType = EnumUtility<LevelThemeType>.Get(columnStrings[index++]);
|
||||
BaseHp = int.Parse(columnStrings[index++]);
|
||||
StartCoin = int.Parse(columnStrings[index++]);
|
||||
LevelVictoryType = EnumUtility<LevelVictoryType>.Get(columnStrings[index++]);
|
||||
VictoryParams = columnStrings[index++];
|
||||
RewardGold = int.Parse(columnStrings[index++]);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using GeometryTD.CustomUtility;
|
||||
using GeometryTD.Definition;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace GeometryTD.DataTable
|
||||
{
|
||||
/// <summary>
|
||||
/// 关卡阶段表
|
||||
/// </summary>
|
||||
public class DRLevelPhase : DataRowBase
|
||||
{
|
||||
private int m_Id = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取关卡阶段编号
|
||||
/// </summary>
|
||||
public override int Id => m_Id;
|
||||
|
||||
/// <summary>
|
||||
/// 获取阶段持续时间(秒)
|
||||
/// </summary>
|
||||
public int DurationSeconds { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取阶段结束条件类型
|
||||
/// </summary>
|
||||
public PhaseEndType EndType { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取阶段结束参数
|
||||
/// </summary>
|
||||
public string EndParam { get; private set; }
|
||||
|
||||
public override bool ParseDataRow(string dataRowString, object userData)
|
||||
{
|
||||
string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);
|
||||
for (int i = 0; i < columnStrings.Length; i++)
|
||||
{
|
||||
columnStrings[i] = columnStrings[i].Trim(DataTableExtension.DataTrimSeparators);
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
index++;
|
||||
m_Id = int.Parse(columnStrings[index++]);
|
||||
index++;
|
||||
DurationSeconds = int.Parse(columnStrings[index++]);
|
||||
EndType = ParsePhaseEndType(columnStrings[index++]);
|
||||
EndParam = columnStrings[index++];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private PhaseEndType ParsePhaseEndType(string raw)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(raw))
|
||||
{
|
||||
return PhaseEndType.None;
|
||||
}
|
||||
|
||||
return EnumUtility<PhaseEndType>.Get(raw);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
using System;
|
||||
using GeometryTD.CustomUtility;
|
||||
using GeometryTD.Definition;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace GeometryTD.DataTable
|
||||
{
|
||||
/// <summary>
|
||||
/// 关卡阶段出怪条目表
|
||||
/// </summary>
|
||||
public class DRLevelSpawnEntry : DataRowBase
|
||||
{
|
||||
private int m_Id = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取阶段条目编号
|
||||
/// </summary>
|
||||
public override int Id => m_Id;
|
||||
|
||||
/// <summary>
|
||||
/// 获取敌人出生口编号
|
||||
/// </summary>
|
||||
public int SpawnPointId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取相对开始时间(秒)
|
||||
/// </summary>
|
||||
public int StartTime { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取出怪条目类型
|
||||
/// </summary>
|
||||
public EntryType EntryType { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取敌人编号
|
||||
/// </summary>
|
||||
public int EnemyId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取单次出怪数量
|
||||
/// </summary>
|
||||
public int Count { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取出怪间隔(秒)
|
||||
/// </summary>
|
||||
public float Interval { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取持续时间(秒)
|
||||
/// </summary>
|
||||
public int Duration { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取单怪出生间隔(秒)
|
||||
/// </summary>
|
||||
public float Gap { get; private set; }
|
||||
|
||||
public override bool ParseDataRow(string dataRowString, object userData)
|
||||
{
|
||||
string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);
|
||||
for (int i = 0; i < columnStrings.Length; i++)
|
||||
{
|
||||
columnStrings[i] = columnStrings[i].Trim(DataTableExtension.DataTrimSeparators);
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
index++;
|
||||
m_Id = int.Parse(columnStrings[index++]);
|
||||
index++;
|
||||
SpawnPointId = int.Parse(columnStrings[index++]);
|
||||
StartTime = int.Parse(columnStrings[index++]);
|
||||
EntryType = ParseEntryType(columnStrings[index++]);
|
||||
EnemyId = int.Parse(columnStrings[index++]);
|
||||
Count = int.Parse(columnStrings[index++]);
|
||||
Interval = float.Parse(columnStrings[index++]);
|
||||
Duration = int.Parse(columnStrings[index++]);
|
||||
Gap = float.Parse(columnStrings[index++]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private EntryType ParseEntryType(string raw)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(raw))
|
||||
{
|
||||
return EntryType.None;
|
||||
}
|
||||
|
||||
return EnumUtility<EntryType>.Get(raw);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
// 此文件由工具自动生成,请勿直接修改。
|
||||
// 生成时间:2021-06-16 21:54:35.591
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace GeometryTD.DataTable
|
||||
{
|
||||
/// <summary>
|
||||
/// 音乐配置表。
|
||||
/// </summary>
|
||||
public class DRMusic : DataRowBase
|
||||
{
|
||||
private int m_Id = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取音乐编号。
|
||||
/// </summary>
|
||||
public override int Id
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Id;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源名称。
|
||||
/// </summary>
|
||||
public string AssetName
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public override bool ParseDataRow(string dataRowString, object userData)
|
||||
{
|
||||
string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);
|
||||
for (int i = 0; i < columnStrings.Length; i++)
|
||||
{
|
||||
columnStrings[i] = columnStrings[i].Trim(DataTableExtension.DataTrimSeparators);
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
index++;
|
||||
m_Id = int.Parse(columnStrings[index++]);
|
||||
index++;
|
||||
AssetName = columnStrings[index++];
|
||||
|
||||
GeneratePropertyArray();
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool ParseDataRow(byte[] dataRowBytes, int startIndex, int length, object userData)
|
||||
{
|
||||
using (MemoryStream memoryStream = new MemoryStream(dataRowBytes, startIndex, length, false))
|
||||
{
|
||||
using (BinaryReader binaryReader = new BinaryReader(memoryStream, Encoding.UTF8))
|
||||
{
|
||||
m_Id = binaryReader.Read7BitEncodedInt32();
|
||||
AssetName = binaryReader.ReadString();
|
||||
}
|
||||
}
|
||||
|
||||
GeneratePropertyArray();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void GeneratePropertyArray()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
using System;
|
||||
using GeometryTD.Definition;
|
||||
using GeometryTD.CustomUtility;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace GeometryTD.DataTable
|
||||
{
|
||||
/// <summary>
|
||||
/// 枪口组件表
|
||||
/// </summary>
|
||||
public class DRMuzzleComp : DataRowBase
|
||||
{
|
||||
private int m_Id = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取枪口组件编号
|
||||
/// </summary>
|
||||
public override int Id => m_Id;
|
||||
|
||||
/// <summary>
|
||||
/// 获取枪口组件名
|
||||
/// </summary>
|
||||
public string Name { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取枪口组件攻击伤害数组
|
||||
/// </summary>
|
||||
public int[] AttackDamage { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取枪口组件每级提升攻击伤害值
|
||||
/// </summary>
|
||||
public int AttackDamagePerLevel { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取攻击伤害浮动
|
||||
/// </summary>
|
||||
public float DamageRandomRate { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取枪口攻击方式
|
||||
/// </summary>
|
||||
public AttackMethodType AttackMethodType { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取属性约束
|
||||
/// </summary>
|
||||
public string Constraint { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取可能出现的 Tag
|
||||
/// </summary>
|
||||
public TagType[] PossibleTag { get; private set; }
|
||||
|
||||
public override bool ParseDataRow(string dataRowString, object userData)
|
||||
{
|
||||
string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);
|
||||
for (int i = 0; i < columnStrings.Length; i++)
|
||||
{
|
||||
columnStrings[i] = columnStrings[i].Trim(DataTableExtension.DataTrimSeparators);
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
index++;
|
||||
m_Id = int.Parse(columnStrings[index++]);
|
||||
index++;
|
||||
Name = columnStrings[index++];
|
||||
AttackDamage = GenerateAttackDamage(columnStrings[index++]);
|
||||
AttackDamagePerLevel = int.Parse(columnStrings[index++]);
|
||||
DamageRandomRate = float.Parse(columnStrings[index++]);
|
||||
AttackMethodType = EnumUtility<AttackMethodType>.Get(columnStrings[index++]);
|
||||
Constraint = columnStrings[index++];
|
||||
PossibleTag = GeneratePossibleTag(columnStrings[index++]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private int[] GenerateAttackDamage(string raw)
|
||||
{
|
||||
if (!raw.StartsWith('[') || !raw.EndsWith(']'))
|
||||
{
|
||||
throw new ArgumentException("Input must be enclosed in square brackets.");
|
||||
}
|
||||
|
||||
if (raw.Length == 2) return new int[] { };
|
||||
string[] raws = raw.Substring(1, raw.Length - 2).Split(",");
|
||||
int length = raws.Length;
|
||||
var damages = new int[length];
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
damages[i] = int.Parse(raws[i]);
|
||||
}
|
||||
|
||||
return damages;
|
||||
}
|
||||
|
||||
private TagType[] GeneratePossibleTag(string raw)
|
||||
{
|
||||
if (!raw.StartsWith('[') || !raw.EndsWith(']'))
|
||||
{
|
||||
throw new ArgumentException("Input must be enclosed in square brackets.");
|
||||
}
|
||||
|
||||
if (raw.Length == 2) return new TagType[] { };
|
||||
string[] tagTypes = raw.Substring(1, raw.Length - 2).Split(",");
|
||||
int length = tagTypes.Length;
|
||||
var tags = new TagType[length];
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
tags[i] = EnumUtility<TagType>.Get(tagTypes[i]);
|
||||
}
|
||||
|
||||
return tags;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
using System;
|
||||
using GeometryTD.CustomUtility;
|
||||
using GeometryTD.Definition;
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace GeometryTD.DataTable
|
||||
{
|
||||
/// <summary>
|
||||
/// 局外道具掉落池配置表。
|
||||
/// </summary>
|
||||
public class DROutGameDropPool : DataRowBase
|
||||
{
|
||||
private int m_Id = 0;
|
||||
|
||||
public override int Id => m_Id;
|
||||
|
||||
public LevelThemeType LevelThemeType { get; private set; }
|
||||
public string ItemType { get; private set; }
|
||||
public int ItemId { get; private set; }
|
||||
public int[] Weights { get; private set; }
|
||||
public int[] MinPhase { get; private set; }
|
||||
public int[] MaxPhase { get; private set; }
|
||||
|
||||
public override bool ParseDataRow(string dataRowString, object userData)
|
||||
{
|
||||
string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);
|
||||
for (int i = 0; i < columnStrings.Length; i++)
|
||||
{
|
||||
columnStrings[i] = columnStrings[i].Trim(DataTableExtension.DataTrimSeparators);
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
index++;
|
||||
m_Id = int.Parse(columnStrings[index++]);
|
||||
index++;
|
||||
LevelThemeType = EnumUtility<LevelThemeType>.Get(columnStrings[index++]);
|
||||
ItemType = columnStrings[index++];
|
||||
ItemId = ParseIntOrDefault(columnStrings[index++], 0);
|
||||
Weights = ParseWeights(columnStrings[index++]);
|
||||
MinPhase = ParsePhases(columnStrings[index++], 1);
|
||||
MaxPhase = ParsePhases(columnStrings[index++], int.MaxValue);
|
||||
NormalizePhaseRanges();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public int GetWeight(RarityType rarity)
|
||||
{
|
||||
int index = Mathf.Clamp((int)rarity - 1, 0, RarityCount - 1);
|
||||
return Weights[index];
|
||||
}
|
||||
|
||||
public int GetMinPhase(RarityType rarity)
|
||||
{
|
||||
int index = Mathf.Clamp((int)rarity - 1, 0, RarityCount - 1);
|
||||
return MinPhase[index];
|
||||
}
|
||||
|
||||
public int GetMaxPhase(RarityType rarity)
|
||||
{
|
||||
int index = Mathf.Clamp((int)rarity - 1, 0, RarityCount - 1);
|
||||
return MaxPhase[index];
|
||||
}
|
||||
|
||||
private static int[] ParseWeights(string raw)
|
||||
{
|
||||
if (!raw.StartsWith('[') || !raw.EndsWith(']'))
|
||||
{
|
||||
throw new ArgumentException("Weights must be enclosed in square brackets.");
|
||||
}
|
||||
|
||||
if (raw.Length == 2)
|
||||
{
|
||||
return new int[RarityCount];
|
||||
}
|
||||
|
||||
string[] raws = raw.Substring(1, raw.Length - 2).Split(",");
|
||||
if (raws.Length != RarityCount)
|
||||
{
|
||||
throw new ArgumentException($"Weights must contain exactly {RarityCount} values.");
|
||||
}
|
||||
|
||||
int[] weights = new int[RarityCount];
|
||||
for (int i = 0; i < raws.Length; i++)
|
||||
{
|
||||
weights[i] = Mathf.Max(0, int.Parse(raws[i]));
|
||||
}
|
||||
|
||||
return weights;
|
||||
}
|
||||
|
||||
private static int[] ParsePhases(string raw, int fallbackValue)
|
||||
{
|
||||
if (!raw.StartsWith('[') || !raw.EndsWith(']'))
|
||||
{
|
||||
throw new ArgumentException("Phase ranges must be enclosed in square brackets.");
|
||||
}
|
||||
|
||||
if (raw.Length == 2)
|
||||
{
|
||||
int[] fallbackValues = new int[RarityCount];
|
||||
for (int i = 0; i < fallbackValues.Length; i++)
|
||||
{
|
||||
fallbackValues[i] = fallbackValue;
|
||||
}
|
||||
|
||||
return fallbackValues;
|
||||
}
|
||||
|
||||
string[] raws = raw.Substring(1, raw.Length - 2).Split(",");
|
||||
if (raws.Length != RarityCount)
|
||||
{
|
||||
throw new ArgumentException($"Phase ranges must contain exactly {RarityCount} values.");
|
||||
}
|
||||
|
||||
int[] phases = new int[RarityCount];
|
||||
for (int i = 0; i < raws.Length; i++)
|
||||
{
|
||||
phases[i] = int.Parse(raws[i]);
|
||||
}
|
||||
|
||||
return phases;
|
||||
}
|
||||
|
||||
private void NormalizePhaseRanges()
|
||||
{
|
||||
for (int i = 0; i < RarityCount; i++)
|
||||
{
|
||||
if (MinPhase[i] <= 0)
|
||||
{
|
||||
MinPhase[i] = 1;
|
||||
}
|
||||
|
||||
if (MaxPhase[i] < MinPhase[i])
|
||||
{
|
||||
MaxPhase[i] = MinPhase[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static int ParseIntOrDefault(string raw, int fallbackValue)
|
||||
{
|
||||
if (int.TryParse(raw, out int parsed))
|
||||
{
|
||||
return parsed;
|
||||
}
|
||||
|
||||
return fallbackValue;
|
||||
}
|
||||
|
||||
private const int RarityCount = (int)RarityType.Red;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using GeometryTD.CustomUtility;
|
||||
using GeometryTD.Definition;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace GeometryTD.DataTable
|
||||
{
|
||||
public sealed class DRRarityTagBudget : DataRowBase
|
||||
{
|
||||
private int m_Id;
|
||||
|
||||
public override int Id => m_Id;
|
||||
|
||||
public RarityType Rarity { get; private set; }
|
||||
|
||||
public int MinCount { get; private set; }
|
||||
|
||||
public int MaxCount { get; private set; }
|
||||
|
||||
public override bool ParseDataRow(string dataRowString, object userData)
|
||||
{
|
||||
string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);
|
||||
for (int i = 0; i < columnStrings.Length; i++)
|
||||
{
|
||||
columnStrings[i] = columnStrings[i].Trim(DataTableExtension.DataTrimSeparators);
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
index++;
|
||||
m_Id = int.Parse(columnStrings[index++]);
|
||||
index++;
|
||||
Rarity = EnumUtility<RarityType>.Get(columnStrings[index++]);
|
||||
MinCount = int.Parse(columnStrings[index++]);
|
||||
MaxCount = int.Parse(columnStrings[index++]);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
using GameFramework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace GeometryTD.DataTable
|
||||
{
|
||||
/// <summary>
|
||||
/// 场景配置表。
|
||||
/// </summary>
|
||||
public class DRScene : DataRowBase
|
||||
{
|
||||
private int m_Id = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取场景编号。
|
||||
/// </summary>
|
||||
public override int Id
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Id;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源名称。
|
||||
/// </summary>
|
||||
public string AssetName
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取背景音乐编号。
|
||||
/// </summary>
|
||||
public int BackgroundMusicId
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public override bool ParseDataRow(string dataRowString, object userData)
|
||||
{
|
||||
string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);
|
||||
for (int i = 0; i < columnStrings.Length; i++)
|
||||
{
|
||||
columnStrings[i] = columnStrings[i].Trim(DataTableExtension.DataTrimSeparators);
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
index++;
|
||||
m_Id = int.Parse(columnStrings[index++]);
|
||||
index++;
|
||||
AssetName = columnStrings[index++];
|
||||
BackgroundMusicId = int.Parse(columnStrings[index++]);
|
||||
|
||||
GeneratePropertyArray();
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool ParseDataRow(byte[] dataRowBytes, int startIndex, int length, object userData)
|
||||
{
|
||||
using (MemoryStream memoryStream = new MemoryStream(dataRowBytes, startIndex, length, false))
|
||||
{
|
||||
using (BinaryReader binaryReader = new BinaryReader(memoryStream, Encoding.UTF8))
|
||||
{
|
||||
m_Id = binaryReader.Read7BitEncodedInt32();
|
||||
AssetName = binaryReader.ReadString();
|
||||
BackgroundMusicId = binaryReader.Read7BitEncodedInt32();
|
||||
}
|
||||
}
|
||||
|
||||
GeneratePropertyArray();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void GeneratePropertyArray()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using GeometryTD.CustomUtility;
|
||||
using GeometryTD.Definition;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace GeometryTD.DataTable
|
||||
{
|
||||
public class DRShopPrice : DataRowBase
|
||||
{
|
||||
private int m_Id = 0;
|
||||
|
||||
public override int Id => m_Id;
|
||||
|
||||
public RarityType Rarity { get; set; }
|
||||
|
||||
public int MinPrice { get; set; }
|
||||
|
||||
public int MaxPrice { get; set; }
|
||||
|
||||
public override bool ParseDataRow(string dataRowString, object userData)
|
||||
{
|
||||
string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);
|
||||
for (int i = 0; i < columnStrings.Length; i++)
|
||||
{
|
||||
columnStrings[i] = columnStrings[i].Trim(DataTableExtension.DataTrimSeparators);
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
index++;
|
||||
m_Id = int.Parse(columnStrings[index++]);
|
||||
index++;
|
||||
Rarity = EnumUtility<RarityType>.Get(columnStrings[index++]);
|
||||
MinPrice = int.Parse(columnStrings[index++]);
|
||||
MaxPrice = int.Parse(columnStrings[index++]);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace GeometryTD.DataTable
|
||||
{
|
||||
/// <summary>
|
||||
/// 声音配置表。
|
||||
/// </summary>
|
||||
public class DRSound : DataRowBase
|
||||
{
|
||||
private int m_Id = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取声音编号。
|
||||
/// </summary>
|
||||
public override int Id
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Id;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源名称。
|
||||
/// </summary>
|
||||
public string AssetName
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取优先级(默认0,128最高,-128最低)。
|
||||
/// </summary>
|
||||
public int Priority
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取是否循环。
|
||||
/// </summary>
|
||||
public bool Loop
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取音量(0~1)。
|
||||
/// </summary>
|
||||
public float Volume
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取声音空间混合量(0为2D,1为3D,中间值混合效果)。
|
||||
/// </summary>
|
||||
public float SpatialBlend
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取声音最大距离。
|
||||
/// </summary>
|
||||
public float MaxDistance
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public override bool ParseDataRow(string dataRowString, object userData)
|
||||
{
|
||||
string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);
|
||||
for (int i = 0; i < columnStrings.Length; i++)
|
||||
{
|
||||
columnStrings[i] = columnStrings[i].Trim(DataTableExtension.DataTrimSeparators);
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
index++;
|
||||
m_Id = int.Parse(columnStrings[index++]);
|
||||
index++;
|
||||
AssetName = columnStrings[index++];
|
||||
Priority = int.Parse(columnStrings[index++]);
|
||||
Loop = bool.Parse(columnStrings[index++]);
|
||||
Volume = float.Parse(columnStrings[index++]);
|
||||
SpatialBlend = float.Parse(columnStrings[index++]);
|
||||
MaxDistance = float.Parse(columnStrings[index++]);
|
||||
|
||||
GeneratePropertyArray();
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool ParseDataRow(byte[] dataRowBytes, int startIndex, int length, object userData)
|
||||
{
|
||||
using (MemoryStream memoryStream = new MemoryStream(dataRowBytes, startIndex, length, false))
|
||||
{
|
||||
using (BinaryReader binaryReader = new BinaryReader(memoryStream, Encoding.UTF8))
|
||||
{
|
||||
m_Id = binaryReader.Read7BitEncodedInt32();
|
||||
AssetName = binaryReader.ReadString();
|
||||
Priority = binaryReader.Read7BitEncodedInt32();
|
||||
Loop = binaryReader.ReadBoolean();
|
||||
Volume = binaryReader.ReadSingle();
|
||||
SpatialBlend = binaryReader.ReadSingle();
|
||||
MaxDistance = binaryReader.ReadSingle();
|
||||
}
|
||||
}
|
||||
|
||||
GeneratePropertyArray();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void GeneratePropertyArray()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using GeometryTD.Definition;
|
||||
using GeometryTD.CustomUtility;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace GeometryTD.DataTable
|
||||
{
|
||||
/// <summary>
|
||||
/// Tag 表
|
||||
/// </summary>
|
||||
public class DRTag : DataRowBase
|
||||
{
|
||||
private int m_Id = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取 Tag 编号
|
||||
/// </summary>
|
||||
public override int Id => m_Id;
|
||||
|
||||
/// <summary>
|
||||
/// 获取 Tag 名
|
||||
/// </summary>
|
||||
public string Name { get; private set; }
|
||||
|
||||
public TagType TagType => (TagType)m_Id;
|
||||
|
||||
public string TagGroupText { get; private set; }
|
||||
|
||||
public RarityType MinRarity { get; private set; }
|
||||
|
||||
public int Weight { get; private set; }
|
||||
|
||||
public bool IsImplemented { get; private set; }
|
||||
|
||||
public override bool ParseDataRow(string dataRowString, object userData)
|
||||
{
|
||||
string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);
|
||||
for (int i = 0; i < columnStrings.Length; i++)
|
||||
{
|
||||
columnStrings[i] = columnStrings[i].Trim(DataTableExtension.DataTrimSeparators);
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
index++;
|
||||
m_Id = int.Parse(columnStrings[index++]);
|
||||
index++;
|
||||
Name = columnStrings[index++];
|
||||
|
||||
bool hasExtendedColumns = columnStrings.Length - index >= 4;
|
||||
if (hasExtendedColumns)
|
||||
{
|
||||
TagGroupText = columnStrings[index++];
|
||||
MinRarity = EnumUtility<RarityType>.Get(columnStrings[index++]);
|
||||
Weight = int.Parse(columnStrings[index++]);
|
||||
IsImplemented = bool.Parse(columnStrings[index++]);
|
||||
}
|
||||
else
|
||||
{
|
||||
TagGroupText = string.Empty;
|
||||
MinRarity = EnumUtility<RarityType>.Get(columnStrings[index++]);
|
||||
Weight = int.Parse(columnStrings[index++]);
|
||||
IsImplemented = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using GeometryTD.CustomUtility;
|
||||
using GeometryTD.Definition;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace GeometryTD.DataTable
|
||||
{
|
||||
public sealed class DRTagConfig : DataRowBase
|
||||
{
|
||||
private int m_Id;
|
||||
|
||||
public override int Id => m_Id;
|
||||
|
||||
public TagType TagType { get; private set; }
|
||||
|
||||
public TagTriggerPhase TriggerPhase { get; private set; }
|
||||
|
||||
public string Description { get; private set; }
|
||||
|
||||
public string ParamJson { get; private set; }
|
||||
|
||||
public override bool ParseDataRow(string dataRowString, object userData)
|
||||
{
|
||||
string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);
|
||||
for (int i = 0; i < columnStrings.Length; i++)
|
||||
{
|
||||
columnStrings[i] = columnStrings[i].Trim(DataTableExtension.DataTrimSeparators);
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
index++;
|
||||
m_Id = int.Parse(columnStrings[index++]);
|
||||
index++;
|
||||
TagType = EnumUtility<TagType>.Get(columnStrings[index++]);
|
||||
TriggerPhase = EnumUtility<TagTriggerPhase>.Get(columnStrings[index++]);
|
||||
Description = columnStrings[index++];
|
||||
ParamJson = columnStrings[index++];
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace GeometryTD.DataTable
|
||||
{
|
||||
/// <summary>
|
||||
/// 界面配置表。
|
||||
/// </summary>
|
||||
public class DRUIForm : DataRowBase
|
||||
{
|
||||
private int m_Id = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取界面编号。
|
||||
/// </summary>
|
||||
public override int Id => m_Id;
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源名称。
|
||||
/// </summary>
|
||||
public string AssetName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取界面组名称。
|
||||
/// </summary>
|
||||
public string UIGroupName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取是否允许多个界面实例。
|
||||
/// </summary>
|
||||
public bool AllowMultiInstance { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取是否暂停被其覆盖的界面。
|
||||
/// </summary>
|
||||
public bool PauseCoveredUIForm { get; private set; }
|
||||
|
||||
public override bool ParseDataRow(string dataRowString, object userData)
|
||||
{
|
||||
string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);
|
||||
for (int i = 0; i < columnStrings.Length; i++)
|
||||
{
|
||||
columnStrings[i] = columnStrings[i].Trim(DataTableExtension.DataTrimSeparators);
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
index++;
|
||||
m_Id = int.Parse(columnStrings[index++]);
|
||||
index++;
|
||||
AssetName = columnStrings[index++];
|
||||
UIGroupName = columnStrings[index++];
|
||||
AllowMultiInstance = bool.Parse(columnStrings[index++]);
|
||||
PauseCoveredUIForm = bool.Parse(columnStrings[index++]);
|
||||
|
||||
GeneratePropertyArray();
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool ParseDataRow(byte[] dataRowBytes, int startIndex, int length, object userData)
|
||||
{
|
||||
using (MemoryStream memoryStream = new MemoryStream(dataRowBytes, startIndex, length, false))
|
||||
{
|
||||
using (BinaryReader binaryReader = new BinaryReader(memoryStream, Encoding.UTF8))
|
||||
{
|
||||
m_Id = binaryReader.Read7BitEncodedInt32();
|
||||
AssetName = binaryReader.ReadString();
|
||||
UIGroupName = binaryReader.ReadString();
|
||||
AllowMultiInstance = binaryReader.ReadBoolean();
|
||||
PauseCoveredUIForm = binaryReader.ReadBoolean();
|
||||
}
|
||||
}
|
||||
|
||||
GeneratePropertyArray();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void GeneratePropertyArray()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
// 此文件由工具自动生成,请勿直接修改。
|
||||
// 生成时间:2021-06-16 21:54:35.666
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace GeometryTD.DataTable
|
||||
{
|
||||
/// <summary>
|
||||
/// 声音配置表。
|
||||
/// </summary>
|
||||
public class DRUISound : DataRowBase
|
||||
{
|
||||
private int m_Id = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取声音编号。
|
||||
/// </summary>
|
||||
public override int Id
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Id;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源名称。
|
||||
/// </summary>
|
||||
public string AssetName
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取优先级(默认0,128最高,-128最低)。
|
||||
/// </summary>
|
||||
public int Priority
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取音量(0~1)。
|
||||
/// </summary>
|
||||
public float Volume
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public override bool ParseDataRow(string dataRowString, object userData)
|
||||
{
|
||||
string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);
|
||||
for (int i = 0; i < columnStrings.Length; i++)
|
||||
{
|
||||
columnStrings[i] = columnStrings[i].Trim(DataTableExtension.DataTrimSeparators);
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
index++;
|
||||
m_Id = int.Parse(columnStrings[index++]);
|
||||
index++;
|
||||
AssetName = columnStrings[index++];
|
||||
Priority = int.Parse(columnStrings[index++]);
|
||||
Volume = float.Parse(columnStrings[index++]);
|
||||
|
||||
GeneratePropertyArray();
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool ParseDataRow(byte[] dataRowBytes, int startIndex, int length, object userData)
|
||||
{
|
||||
using (MemoryStream memoryStream = new MemoryStream(dataRowBytes, startIndex, length, false))
|
||||
{
|
||||
using (BinaryReader binaryReader = new BinaryReader(memoryStream, Encoding.UTF8))
|
||||
{
|
||||
m_Id = binaryReader.Read7BitEncodedInt32();
|
||||
AssetName = binaryReader.ReadString();
|
||||
Priority = binaryReader.Read7BitEncodedInt32();
|
||||
Volume = binaryReader.ReadSingle();
|
||||
}
|
||||
}
|
||||
|
||||
GeneratePropertyArray();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void GeneratePropertyArray()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework.DataTable;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace GeometryTD.DataTable
|
||||
{
|
||||
public static class DataTableExtension
|
||||
{
|
||||
private const string DataRowClassPrefixName = "GeometryTD.DataTable.DR";
|
||||
internal static readonly char[] DataSplitSeparators = new char[] { '\t' };
|
||||
internal static readonly char[] DataTrimSeparators = new char[] { '\"' };
|
||||
|
||||
public static void LoadDataTable(this DataTableComponent dataTableComponent, string dataTableName, string dataTableAssetName, object userData)
|
||||
{
|
||||
if (string.IsNullOrEmpty(dataTableName))
|
||||
{
|
||||
Log.Warning("Data table name is invalid.");
|
||||
return;
|
||||
}
|
||||
|
||||
string[] splitedNames = dataTableName.Split('_');
|
||||
if (splitedNames.Length > 2)
|
||||
{
|
||||
Log.Warning("Data table name is invalid.");
|
||||
return;
|
||||
}
|
||||
|
||||
string dataRowClassName = DataRowClassPrefixName + splitedNames[0];
|
||||
Type dataRowType = Type.GetType(dataRowClassName);
|
||||
if (dataRowType == null)
|
||||
{
|
||||
Log.Warning("Can not get data row type with class name '{0}'.", dataRowClassName);
|
||||
return;
|
||||
}
|
||||
|
||||
string name = splitedNames.Length > 1 ? splitedNames[1] : null;
|
||||
DataTableBase dataTable = dataTableComponent.CreateDataTable(dataRowType, name);
|
||||
dataTable.ReadData(dataTableAssetName, Constant.AssetPriority.DataTableAsset, userData);
|
||||
}
|
||||
|
||||
public static Color32 ParseColor32(string value)
|
||||
{
|
||||
string[] splitedValue = value.Split(',');
|
||||
return new Color32(byte.Parse(splitedValue[0]), byte.Parse(splitedValue[1]), byte.Parse(splitedValue[2]), byte.Parse(splitedValue[3]));
|
||||
}
|
||||
|
||||
public static Color ParseColor(string value)
|
||||
{
|
||||
string[] splitedValue = value.Split(',');
|
||||
return new Color(float.Parse(splitedValue[0]), float.Parse(splitedValue[1]), float.Parse(splitedValue[2]), float.Parse(splitedValue[3]));
|
||||
}
|
||||
|
||||
public static Quaternion ParseQuaternion(string value)
|
||||
{
|
||||
string[] splitedValue = value.Split(',');
|
||||
return new Quaternion(float.Parse(splitedValue[0]), float.Parse(splitedValue[1]), float.Parse(splitedValue[2]), float.Parse(splitedValue[3]));
|
||||
}
|
||||
|
||||
public static Rect ParseRect(string value)
|
||||
{
|
||||
string[] splitedValue = value.Split(',');
|
||||
return new Rect(float.Parse(splitedValue[0]), float.Parse(splitedValue[1]), float.Parse(splitedValue[2]), float.Parse(splitedValue[3]));
|
||||
}
|
||||
|
||||
public static Vector2 ParseVector2(string value)
|
||||
{
|
||||
string[] splitedValue = value.Split(',');
|
||||
return new Vector2(float.Parse(splitedValue[0]), float.Parse(splitedValue[1]));
|
||||
}
|
||||
|
||||
public static Vector3 ParseVector3(string value)
|
||||
{
|
||||
string[] splitedValue = value.Split(',');
|
||||
return new Vector3(float.Parse(splitedValue[0]), float.Parse(splitedValue[1]), float.Parse(splitedValue[2]));
|
||||
}
|
||||
|
||||
public static Vector4 ParseVector4(string value)
|
||||
{
|
||||
string[] splitedValue = value.Split(',');
|
||||
return new Vector4(float.Parse(splitedValue[0]), float.Parse(splitedValue[1]), float.Parse(splitedValue[2]), float.Parse(splitedValue[3]));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user