This commit is contained in:
liuliang 2025-01-08 14:12:15 +08:00
commit 73d6cd84b7
44 changed files with 1365 additions and 807 deletions

View File

@ -0,0 +1,47 @@
{
"M_H_001": {
"M_H_001_S_1": {
"1": {
"Range":2
},
"2": {
"DamageBuff": 0.15
},
"3": {
"SkillList": ["skill_0"],
"Range": -1
},
"4": {
"DamageBuff": 0.35
},
"5": {
"AttackCooldown": -0.5,
"AttackContinues":-0.5
}
},
"M_H_001_S_2": {
"1": {
"SkillList": [
"skill_1"
],
"DamageBuff": -0.5
},
"2": {
"DamageBuff": 0.15
},
"3": {
"SkillList": [
"skill_2"
],
"AttackCooldown": 0.05
},
"4": {
"DamageBuff": 0.35
},
"5": {
"AttackCooldown": 0.3,
"AttackContinues": 0.5
}
}
}
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 580cfe3a34ab71847870fa8a367f7e93
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -174,5 +174,21 @@
"AttackCD": "2.5",
"CritRate": "0.05",
"CriticalHitRateBonus": "0"
},
{
"Id": "M_J_004",
"Name": "金萌妖-04",
"Quality": "2",
"Elements": "0",
"Info": "射出一个会返回的“回旋镖”,攻击移动中触碰到的所有敌人。",
"SkillId": "3001",
"AttackType": "2",
"AttackActionType": "2",
"MaxAttack": "12",
"MinAttack": "10",
"AttackRange": "5",
"AttackCD": "2.5",
"CritRate": "0.08",
"CriticalHitRateBonus": "0"
}
]

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1103e900f5bb65c488bf44cc7e57e727
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1c5eadd36a678d24bb89ca26fdc281f3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,22 @@
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
[CustomEditor(typeof(Base), true)]
public class BaseEditor : Editor
{
public override void OnInspectorGUI()
{
// 获取目标对象
Base layoutPor = (Base)target;
// 显示静态描述内容
// EditorGUILayout.LabelField("Description", EditorStyles.boldLabel);
EditorGUILayout.HelpBox(layoutPor.description, MessageType.Info);
// 绘制默认属性
DrawDefaultInspector();
}
}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 01f8800bc22567f4890b6a945671d07b
guid: a8989a58477334fc88970308aa31745a
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5af7f82681e0249cb929c96cabbc342b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,70 @@
using System.Text;
using TMPro;
using UnityEditor;
using UnityEngine;
public class TMPChineseFontGenerator : MonoBehaviour
{
[MenuItem("Tools/渲染字体")]
public static void GenerateTMPFontWithChinese()
{
// 字体文件路径(替换为实际路径)
string fontPath = "Assets/Font/Songti.ttc";
string outputPath = "Assets/Font/GeneratedChineseFont.asset";
// 加载字体文件
Font font = AssetDatabase.LoadAssetAtPath<Font>(fontPath);
if (font == null)
{
Debug.LogError($"Font not found at path: {fontPath}");
return;
}
// 创建字体资产
TMP_FontAsset fontAsset = TMP_FontAsset.CreateFontAsset(font);
// 获取常用汉字字符集
string chineseRange = GetChineseCharacters();
// 添加汉字字符到字体资产
AddCharactersToFontAsset(fontAsset, chineseRange);
// 保存字体资产
AssetDatabase.CreateAsset(fontAsset, outputPath);
AssetDatabase.SaveAssets();
Debug.Log($"包含中文字符的字体资产在: {outputPath}");
}
// 获取常用汉字字符集
private static string GetChineseCharacters()
{
int start = 0x4e00; // 汉字起始点
int end = 0x9fff; // 汉字结束点
StringBuilder characters = new StringBuilder();
for (int i = start; i <= end; i++)
{
characters.Append((char)i);
}
return characters.ToString();
}
// 添加字符到字体资产
private static void AddCharactersToFontAsset(TMP_FontAsset fontAsset, string characters)
{
// 遍历每个字符并尝试添加
foreach (char c in characters)
{
if (!fontAsset.HasCharacter(c))
{
fontAsset.characterLookupTable.TryGetValue(c, out TMP_Character tmpCharacter);
if (tmpCharacter == null)
{
Debug.Log($"Character '{c}' 无法添加。确保字体支持此字符。");
}
}
}
}
}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 95b03e0e868ee84449f3fbfa7423a3a5
guid: 58bd507c3732f498fb421fd0e5878d9c
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8be33d5cadce7e44ea28b89be20d74ab
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a8808b675b86fd64d9ad4d6e99d13c35
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -296,8 +296,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 28012bb73bbdd3a4f881dda28759bfa4, type: 3}
m_Name:
m_EditorClassIdentifier:
retbutton: {fileID: 0}
ClosureObj: {fileID: 0}
description:
waypoints:
_waypoints:
- {fileID: 0}
@ -325,13 +324,12 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 1d85d2602d10e0b45820f1be35eda782, type: 3}
m_Name:
m_EditorClassIdentifier:
retbutton: {fileID: 0}
ClosureObj: {fileID: 0}
description:
id:
Name:
camp: 1
hp: 20
maxHp: 20
hp: 1
maxHp: 1
dieIndex: 1
Hpfiil: {fileID: 1566038940701374259}
HpfiilYello: {fileID: 605146830908541898}

View File

@ -296,8 +296,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 28012bb73bbdd3a4f881dda28759bfa4, type: 3}
m_Name:
m_EditorClassIdentifier:
retbutton: {fileID: 0}
ClosureObj: {fileID: 0}
description:
waypoints:
_waypoints:
- {fileID: 0}
@ -325,13 +324,12 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 1d85d2602d10e0b45820f1be35eda782, type: 3}
m_Name:
m_EditorClassIdentifier:
retbutton: {fileID: 0}
ClosureObj: {fileID: 0}
description:
id:
Name:
camp: 1
hp: 20
maxHp: 20
hp: 1
maxHp: 1
dieIndex: 1
Hpfiil: {fileID: 1566038940701374259}
HpfiilYello: {fileID: 605146830908541898}

View File

@ -223,8 +223,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8433650274046349753}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0.4, z: 0}
m_LocalScale: {x: 0.14, y: 0.14, z: 0.16}
m_LocalPosition: {x: 0, y: 0.7, z: 0}
m_LocalScale: {x: 0.2, y: 0.2, z: 0.2}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8433650275485930555}
@ -366,7 +366,7 @@ MonoBehaviour:
damageTyp: 2
attackCooldown: 1
bulltes: []
animator: {fileID: 0}
animator: {fileID: 3097922873946836253}
fireAnis: []
BulletStartPos: {fileID: 2562350995381512747}
AttackSpeed: 1
@ -472,8 +472,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
retbutton: {fileID: 0}
ClosureObj: {fileID: 0}
id: M_M_001
Name: "\u6728\u840C\u5996-01"
id: M_J_004
Name: "\u91D1\u840C\u5996-04"
camp: 0
hp: 100
maxHp: 100

View File

@ -463,9 +463,17 @@ MonoBehaviour:
AttackStayTime: 2
Target: {fileID: 0}
characterClick: {fileID: 8940501394638592702}
Angle: 30
splitNum: 2
SplitAttack: 10
RunRange: 3
haveAddDamage: 0
AdddamageType: 1
BoomRange: 1
isAttack: 1
flag: 0
timer: 0
bulletLengthAdd: 0
--- !u!61 &7445357650989261112
BoxCollider2D:
m_ObjectHideFlags: 0
@ -506,7 +514,7 @@ GameObject:
- component: {fileID: -3836672401185760439}
- component: {fileID: 1608620729910401442}
- component: {fileID: 7351378797470834992}
- component: {fileID: 1061754087244483355}
- component: {fileID: -8090661455022979364}
m_Layer: 0
m_Name: laohu
m_TagString: Player
@ -558,8 +566,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 1d85d2602d10e0b45820f1be35eda782, type: 3}
m_Name:
m_EditorClassIdentifier:
retbutton: {fileID: 0}
ClosureObj: {fileID: 0}
description:
id: M_H_001
Name: "\u706B\u840C\u5996-01"
camp: 0
@ -583,6 +590,7 @@ MonoBehaviour:
CritRate: 0.03
CriticalHitRateBonus: 0.25
killNum: 0
isMoFa: 0
gold: 10
MaxAttack: 5
MinAttack: 4
@ -602,22 +610,25 @@ MonoBehaviour:
normalIndex: 0
isHit: 0
myTags: 0
mySkillUp: {fileID: 1061754087244483355}
mySkillUp: {fileID: -8090661455022979364}
IsDead: 0
HaveDieTime: 0
enemyId:
bulletAttackType: 0
moveSpeed: 0
MengyaoSprite: {fileID: 21300000, guid: d3d3d16c3383ae1468c21c193ac1d2e8, type: 3}
SkillSprites:
- {fileID: 21300000, guid: fdd1af82c4a2e3b43adb1ef595ec34d0, type: 3}
- {fileID: 21300000, guid: 4043457f6fd1cda4eb486839f31d2806, type: 3}
harmNumber: 0
isSlowed: 0
Defense: 0
DamageToPlayer: 0
HealthPerLevel: 0
DefensePerLevel: 0
elementType: 3
defenseType: 0
index: 0
--- !u!61 &-3836672401185760439
BoxCollider2D:
m_ObjectHideFlags: 0
@ -710,7 +721,7 @@ SpriteRenderer:
m_WasSpriteAssigned: 0
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!114 &1061754087244483355
--- !u!114 &-8090661455022979364
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@ -719,11 +730,10 @@ MonoBehaviour:
m_GameObject: {fileID: 8433650275485930554}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b8d04d25bab1a3541925d4cc205ad1d8, type: 3}
m_Script: {fileID: 11500000, guid: 8264f0a4afc0aa347bf9dad42df2617a, type: 3}
m_Name:
m_EditorClassIdentifier:
retbutton: {fileID: 0}
ClosureObj: {fileID: 0}
description: "\u66F4\u65B0\u540E\u7684\u840C\u8000\uFF0C\uFF1A\u4F7F\u7528\u65B9\u6CD5xxxxxxxx"
role: {fileID: 8433650274028726420}
attack: {fileID: 7276635428522831207}
attackRange: 0
@ -738,3 +748,4 @@ MonoBehaviour:
DamageOfland: 0
DamageOfBig: 0
DamageOfMin: 0
DamageOfSlow: 0

View File

@ -0,0 +1,687 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &4405472214899975644
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 671171724868939146}
- component: {fileID: 1337899852504724184}
- component: {fileID: 5157915909928442228}
m_Layer: 5
m_Name: Image
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &671171724868939146
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4405472214899975644}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 5508436328356301500}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -67.7, y: 195}
m_SizeDelta: {x: 40, y: 40}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1337899852504724184
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4405472214899975644}
m_CullTransparentMesh: 1
--- !u!114 &5157915909928442228
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4405472214899975644}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: d7e26ca505e81024daeaa6f8c2d39db3, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &5508436327076020825
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5508436327076020838}
- component: {fileID: 5508436327076020836}
- component: {fileID: 5508436327076020839}
m_Layer: 5
m_Name: gaoliang
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5508436327076020838
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5508436327076020825}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 5508436327438263540}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -1, y: 4}
m_SizeDelta: {x: 224, y: 294}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5508436327076020836
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5508436327076020825}
m_CullTransparentMesh: 1
--- !u!114 &5508436327076020839
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5508436327076020825}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 91b573803363f634dbcbc7ff258bb113, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &5508436327155225751
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5508436327155225748}
- component: {fileID: 5508436327155225746}
- component: {fileID: 5508436327155225749}
m_Layer: 5
m_Name: Text (Legacy)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5508436327155225748
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5508436327155225751}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 5508436328356301500}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 15.4549}
m_SizeDelta: {x: 234, y: 50.4553}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5508436327155225746
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5508436327155225751}
m_CullTransparentMesh: 1
--- !u!114 &5508436327155225749
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5508436327155225751}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 30
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 0
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: "\u91D1\u86FE"
--- !u!1 &5508436327438263543
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5508436327438263540}
- component: {fileID: 5508436327438263539}
- component: {fileID: 5508436327438263538}
- component: {fileID: 5508436327438263541}
- component: {fileID: 5508436327438263536}
m_Layer: 5
m_Name: card_jez
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5508436327438263540
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5508436327438263543}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 5508436328304430210}
- {fileID: 5508436327076020838}
- {fileID: 5508436328771375861}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5508436327438263539
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5508436327438263543}
m_CullTransparentMesh: 1
--- !u!114 &5508436327438263538
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5508436327438263543}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 2
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 0
m_TargetGraphic: {fileID: 0}
toggleTransition: 1
graphic: {fileID: 5508436327076020839}
m_Group: {fileID: 0}
onValueChanged:
m_PersistentCalls:
m_Calls: []
m_IsOn: 0
--- !u!114 &5508436327438263541
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5508436327438263543}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c80ec7342ba0b09448680eb2ed376380, type: 3}
m_Name:
m_EditorClassIdentifier:
cardIconImage: {fileID: 5508436328917121101}
cardicon: {fileID: 21300000, guid: d8b1c79bf0dd941448fff97989471fce, type: 3}
targetTag: tower
mengyaoPrefab: {fileID: 8433650275485930554, guid: 6b6027f8de5772a40a1a016917855070, type: 3}
mask: {fileID: 5508436328771375860}
mY: {fileID: 0}
--- !u!114 &5508436327438263536
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5508436327438263543}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c64989b3a75e1d44e8692a17ba9c22ea, type: 3}
m_Name:
m_EditorClassIdentifier:
mengyaoid: M_J_004
shuxing: 0
--- !u!1 &5508436328304430213
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5508436328304430210}
- component: {fileID: 5508436328304430209}
- component: {fileID: 5508436328304430208}
- component: {fileID: 5508436328304430211}
m_Layer: 5
m_Name: info
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5508436328304430210
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5508436328304430213}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 5508436328917121100}
- {fileID: 5508436328356301500}
m_Father: {fileID: 5508436327438263540}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 220, y: 290}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5508436328304430209
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5508436328304430213}
m_CullTransparentMesh: 1
--- !u!114 &5508436328304430208
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5508436328304430213}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 7d3f6c1dbe0fc184896b677f0b6ad28f, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &5508436328304430211
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5508436328304430213}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 31a19414c41e5ae4aae2af33fee712f6, type: 3}
m_Name:
m_EditorClassIdentifier:
m_ShowMaskGraphic: 1
--- !u!1 &5508436328356301503
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5508436328356301500}
- component: {fileID: 5508436328356301498}
- component: {fileID: 5508436328356301501}
m_Layer: 5
m_Name: Image
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5508436328356301500
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5508436328356301503}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 5508436327155225748}
- {fileID: 671171724868939146}
m_Father: {fileID: 5508436328304430210}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}
m_AnchoredPosition: {x: -1, y: 37.425293}
m_SizeDelta: {x: 234, y: 81.366}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5508436328356301498
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5508436328356301503}
m_CullTransparentMesh: 1
--- !u!114 &5508436328356301501
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5508436328356301503}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 5a2005fb30b78cc4ab9f29e443f545a0, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &5508436328771375860
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5508436328771375861}
- component: {fileID: 5508436328771375859}
- component: {fileID: 5508436328771375858}
m_Layer: 5
m_Name: mash
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5508436328771375861
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5508436328771375860}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 5508436327438263540}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 220, y: 290}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5508436328771375859
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5508436328771375860}
m_CullTransparentMesh: 1
--- !u!114 &5508436328771375858
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5508436328771375860}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 0.7058824}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: dab6101c2a5349c43a399e3101cb2617, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &5508436328917121103
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5508436328917121100}
- component: {fileID: 5508436328917121098}
- component: {fileID: 5508436328917121101}
m_Layer: 5
m_Name: icon
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5508436328917121100
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5508436328917121103}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 5508436328304430210}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -8, y: 59.6}
m_SizeDelta: {x: 555.6077, y: 493.7528}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5508436328917121098
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5508436328917121103}
m_CullTransparentMesh: 1
--- !u!114 &5508436328917121101
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5508436328917121103}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: d8b1c79bf0dd941448fff97989471fce, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b11fe0bf453623a4c847b716ebbed379
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1456,8 +1456,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: d98d344c0c9573d45a72a1677d806d7d, type: 3}
m_Name:
m_EditorClassIdentifier:
retbutton: {fileID: 0}
ClosureObj: {fileID: 0}
description:
expNumber: 0
expNumberText: {fileID: 385770246}
maxExpNumber: 20
@ -3595,8 +3594,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 36d8b1f23f0ec174594a18d38154925d, type: 3}
m_Name:
m_EditorClassIdentifier:
retbutton: {fileID: 0}
ClosureObj: {fileID: 0}
description:
mengyaoNumber: 3
inPlaceNumber: 0
btnObj: {fileID: 1942153352}
@ -4408,6 +4406,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: ef2ffa387be5c84478c8cf2baec66c02, type: 3}
m_Name:
m_EditorClassIdentifier:
description:
m_Asset: {fileID: 4900000, guid: 6a6cdf5342b444d4fbff4fccbb54f98a, type: 3}
NameAsset: {fileID: 4900000, guid: e414de6ecc2f57d4ba107a5433dd54f5, type: 3}
LevelAsset: {fileID: 4900000, guid: 89bbacca41b409b4dbf238a43bbb2e4b, type: 3}
@ -4425,6 +4424,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: f1617263e713d804995e0d3f3073e0cb, type: 3}
m_Name:
m_EditorClassIdentifier:
description:
MapLevelJson: {fileID: 4900000, guid: b534002cbb7fddf4bb68f34fb1357ff3, type: 3}
count: 0
--- !u!1 &1342038372
@ -5523,8 +5523,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 55658941a61a95a449a60aa939a8c641, type: 3}
m_Name:
m_EditorClassIdentifier:
retbutton: {fileID: 0}
ClosureObj: {fileID: 0}
description:
BloodText: {fileID: 1288391609}
MaxHp: 20
NowShowInfo: {fileID: 0}
@ -5895,8 +5894,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 97664c5246bb0d242997921b3560d036, type: 3}
m_Name:
m_EditorClassIdentifier:
retbutton: {fileID: 0}
ClosureObj: {fileID: 0}
description:
SpawnLocations:
- {fileID: 734893407}
enemysList: []

View File

@ -5976,6 +5976,9 @@ MonoBehaviour:
- id: M_T_001
prefab: {fileID: 8433650275485930554, guid: c06add8b28931e4448ca9673388595af, type: 3}
cardprefab: {fileID: 5508436327438263543, guid: 93fef5acddd00004b9ba1f30ccd46c96, type: 3}
- id: M_J_004
prefab: {fileID: 8433650275485930554, guid: 6b6027f8de5772a40a1a016917855070, type: 3}
cardprefab: {fileID: 5508436327438263543, guid: b11fe0bf453623a4c847b716ebbed379, type: 3}
--- !u!114 &1910338487
MonoBehaviour:
m_ObjectHideFlags: 0

View File

@ -1,14 +1,18 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[ExecuteInEditMode]
public class SkillUp : Fun
{
[Header("角色脚本")] public Role role;
[Header("攻击脚本")]public Attack attack;
// public string skill_id_1 = null;
// public string skill_id_2 = null;
[HideInInspector][Header("攻击范围加成")] public float attackRange = 0f;
[HideInInspector]
public float AttackRange
@ -59,6 +63,7 @@ public class SkillUp : Fun
}
[HideInInspector][Header("攻击子弹速度加成")] public float speedOfBullets = 0f;
[HideInInspector]
public float SpeedOfBullets
{
get => speedOfBullets;
@ -83,36 +88,66 @@ public class SkillUp : Fun
// 存储技能加成效果
private Dictionary<string, Dictionary<int, System.Action>> skillUpgrades = new Dictionary<string, Dictionary<int, System.Action>>();
public virtual void Start()
private void Awake()
{
// 初始化技能加成升级
InitializeSkillUpgrades();
description = "更新后的萌耀使用方法xxxxxxxx";
}
// 初始化技能加成升级
private void InitializeSkillUpgrades()
public void Up(string mengyao_id,string skill_id,string level)
{
// 技能1的加成效果
skillUpgrades["Skill_1"] = new Dictionary<int, System.Action>
{
{ 1, Skill_1_1 },
{ 2, Skill_1_2 },
{ 3, Skill_1_3 },
{ 4, Skill_1_4 },
{ 5, Skill_1_5 }
};
// 技能2的加成效果
skillUpgrades["Skill_2"] = new Dictionary<int, System.Action>
Debug.LogError(GlobalObj.GetComponent<Mengyao_Skill_Date>().parsedData.Count);
SkillLevelData info = GlobalObj.GetComponent<Mengyao_Skill_Date>().parsedData[mengyao_id][skill_id][level];
//攻击范围加成
AttackRange += info.Range;
Debug.Log("攻击范围+"+ info.Range +"||"+ attackRange.ToString()+"=================================");
//攻击冷却加成
AttackCooldown += info.AttackCooldown;
//攻击持续时间加成
AttackDuration += info.AttackContinues;
//攻击子弹数量加成
NumberOfBullets += info.numberOfBullets;
//攻击子弹速度加成
SpeedOfBullets += info.speedOfBullets;
//攻击伤害加成
DamageUp += info.DamageBuff;
//暴击率倍率加成
CriticalRate += info.CriticalRate;
//暴击伤害倍率加成
CriticalDamage += info.CriticalDamage;
//对空伤害加成
DamageOfSky += info.DamageOfSky;
//对地伤害加成
DamageOfland += info.DamageOfland;
//对大型敌人加成
DamageOfBig += info.DamageOfBig;
//对小型型敌人加成
DamageOfMin += info.DamageOfMin;
//对减速敌人加成
DamageOfSlow += info.DamageOfSlow;
attack.SetAttackRange();
if (info.SkillList != null)
{
{ 1, Skill_2_1 },
{ 2, Skill_2_2 },
{ 3, Skill_2_3 },
{ 4, Skill_2_4 },
{ 5, Skill_2_5 }
};
foreach (string SkillId in info.SkillList)
{
if (SkillId == "skill_0")
{
// 创建一个眩晕 Buff持续1秒20%概率)
Action<Role> decelerationBuff = CreateDecelerationBuff(1f, 0.2f);
// 将 Buff 添加到玩家的 storageBuff 列表中
role.AddBuff(role.storageBuff, decelerationBuff);
//Debug.LogError("使用技能1-3");
}
}
}
}
/// <summary>
/// 使用技能
/// </summary>
@ -120,32 +155,6 @@ public class SkillUp : Fun
/// <param name="level">等级</param>
public void UseSkill(int index, int level)
{
string skillKey = $"Skill_{index}";
// 判断是否有这个技能
if (skillUpgrades.ContainsKey(skillKey) && skillUpgrades[skillKey].ContainsKey(level))
{
// 调用相应技能等级的效果
skillUpgrades[skillKey][level].Invoke();
}
else
{
Debug.LogWarning("没有这个技能或者技能等级无效");
}
Up(role.id, role.id + "_S_" + index.ToString(), level.ToString());
}
public virtual void Skill_1_1() { }
public virtual void Skill_1_2() { DamageUp *= 1.15f; Debug.LogError("使用技能1-2"); }
public virtual void Skill_1_3() { }
public virtual void Skill_1_4() { DamageUp *= 1.35f; Debug.LogError("使用技能1-4"); }
public virtual void Skill_1_5() { }
public virtual void Skill_2_1() { }
public virtual void Skill_2_2() { DamageUp *= 1.15f; Debug.LogError("使用技能2-2"); }
public virtual void Skill_2_3() { }
public virtual void Skill_2_4() { DamageUp *= 1.35f; Debug.LogError("使用技能2-4"); }
public virtual void Skill_2_5() { }
}
}

View File

@ -1,61 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class cs_SkillUp : SkillUp
{
/// <summary>
///对空中的敌人额外造成30%伤害
/// </summary>
public override void Skill_1_1()
{
base.DamageOfSky+=0.3f;
}
/// <summary>
/// 攻击CD减少25%散射角度增加25%射程减少1格
/// </summary>
public override void Skill_1_3()
{
base.attack.Angle *= (1 + 0.25f);//散射角度
AttackCooldown -= 0.25f;
base.AttackRange = -1;
attack.SetAttackRange();
}
/// <summary>
/// 子弹飞行速度增加25%射程减少1格"
/// </summary>
public override void Skill_1_5()
{
base.speedOfBullets+=0.25f;
base.AttackRange = -1;
attack.SetAttackRange();
}
/// <summary>
/// 对地面敌人造成额外30%伤害
/// </summary>
public override void Skill_2_1()
{
base.DamageOfland += 0.3f;
}
/// <summary>
/// 攻击CD减少15%,但散射角度更大
/// </summary>
public override void Skill_2_3()
{
AttackCooldown -= 0.15f;
base.attack.Angle *= (1 + 0.25f);//散射角度
Debug.Log("增加散射角度");
}
/// <summary>
/// 对减速目标造成额外20%伤害攻击CD增加5%
/// </summary>
public override void Skill_2_5()
{
base.DamageOfSlow += 0.2f;
base.AttackCooldown += 0.05f;
}
}

View File

@ -1,65 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
public class hhl_SkillUp : SkillUp
{
/// <summary>
///攻击CD减少25%
/// </summary>
public override void Skill_1_1()
{
base.AttackCooldown -= 0.25f;
}
/// <summary>
/// 火球飞行速度增加15%攻击CD增加5%
/// </summary>
public override void Skill_1_3()
{
base.speedOfBullets += 0.15f;
base.AttackCooldown += 0.05f;
}
/// <summary>
/// 火球飞行速度增加30%攻击CD增加5%"
/// </summary>
public override void Skill_1_5()
{
base.speedOfBullets+=0.3f;
base.AttackCooldown += 0.05f;
}
/// <summary>
/// 火球溅射伤害范围增加1格
/// </summary>
public override void Skill_2_1()
{
attack.BoomRange += 0.5f;
}
/// <summary>
/// 对大型敌人额外造成30%伤害射程减少1格
/// </summary>
public override void Skill_2_3()
{
DamageOfBig += 0.3f;
AttackRange = -1;
attack.SetAttackRange();
}
/// <summary>
/// 被火球伤害的敌人会原地眩晕1秒射程减少1格
/// </summary>
public override void Skill_2_5()
{
base.AttackRange = -1;
attack.SetAttackRange();
// 创建一个眩晕 Buff持续1秒20%概率)
Action<Role> decelerationBuff = CreateDecelerationBuff(1f, 1f);
// 将 Buff 添加到玩家的 storageBuff 列表中
role.AddBuff(role.storageBuff, decelerationBuff);
}
}

View File

@ -1,63 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
public class jbf_SkillUp : SkillUp
{
/// <summary>
///刀的长度延长1格
/// </summary>
public override void Skill_1_1()
{
Debug.Log("jijijijijijijijijijijijijijijijijijij111111");
attack.bulletLengthAdd += 2;
}
/// <summary>
/// 额外增加1把刀刀的旋转速度减少10%
/// </summary>
public override void Skill_1_3()
{
Debug.Log("jijijijijijijijijijijijijijijijijijij");
attack.BulletNumber += 1;
attack.roleBulletSpeedAdd -= 0.1f;
}
/// <summary>
/// 每次攻击额外造成30%魔法伤害,刀的旋转速度减少10%
/// </summary>
public override void Skill_1_5()
{
attack.haveAddDamage = true;
attack.AdddamageType = DamageType.magicDamage;
base.attack.roleBulletSpeedAdd -= 0.1f;
}
/// <summary>
/// 刀的旋转速度提升25%
/// </summary>
public override void Skill_2_1()
{
base.attack.roleBulletSpeedAdd += 0.25f;
}
/// <summary>
/// 额外增加1把刀,刀的旋转速度减少10%
/// </summary>
public override void Skill_2_3()
{
Debug.Log("jijijijijijijijijijijijijijijijijijij");
attack.BulletNumber += 1;
base.attack.roleBulletSpeedAdd -= 0.1f;
}
/// <summary>
/// 刀的旋转速度提升40%
/// </summary>
public override void Skill_2_5()
{
base.attack.roleBulletSpeedAdd += 0.4f;
}
}

View File

@ -1,75 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
using static Google.Protobuf.Reflection.ExtensionRangeOptions.Types;
public class laohuSkillUp :SkillUp
{
/// <summary>
/// 射程提升2格位置
/// </summary>
public override void Skill_1_1()
{
base.AttackRange = 2;
attack.SetAttackRange();
Debug.LogError("使用技能1-1");
}
/// <summary>
/// 被火焰伤害的敌人有20%概率原地眩晕1秒。射程减少1格
/// </summary>
public override void Skill_1_3()
{
base.AttackRange = -1;
attack.SetAttackRange();
// 创建一个眩晕 Buff持续1秒20%概率)
Action<Role> decelerationBuff = CreateDecelerationBuff(1f, 0.2f);
// 将 Buff 添加到玩家的 storageBuff 列表中
role.AddBuff(role.storageBuff,decelerationBuff);
Debug.LogError("使用技能1-3");
}
/// <summary>
/// 喷火冷却时间减少50%,持续喷火时间减少50%
/// </summary>
public override void Skill_1_5()
{
base.AttackCooldown += -0.5f;
base.AttackDuration += -0.5f;
Debug.LogError("使用技能1-5");
}
/// <summary>
/// 喷出的火焰散开为3个。但每个火焰伤害减少50%
/// </summary>
public override void Skill_2_1()
{
base.NumberOfBullets += 2;
base.DamageUp += -0.5f;
Debug.LogError("使用技能2-1");
}
/// <summary>
/// 降低敌人20%移动速度,攻击CD增加5%
/// </summary>
public override void Skill_2_3()
{
base.AttackCooldown += 0.05f;
//buff
Action<Role> decelerationBuff = CreateSlowDownBuff(0.2f, 3f);
// 将 Buff 添加到玩家的 storageBuff 列表中
role.AddBuff(role.storageBuff, decelerationBuff);
Debug.LogError("使用技能2-3");
}
/// <summary>
/// 喷火冷却时间增加30%,持续喷火时间增加50%
/// </summary>
public override void Skill_2_5()
{
base.AttackCooldown += 0.3f;
base.AttackDuration += 0.5f;
Debug.LogError("使用技能2-5");
}
}

View File

@ -1,58 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class mkl_SkillUp : SkillUp
{
/// <summary>
///子弹飞行速度增加30%。
/// </summary>
public override void Skill_1_1()
{
base.SpeedOfBullets = 0.3f;
}
/// <summary>
/// 对小型敌人增加40%伤害攻击CD增加5%
/// </summary>
public override void Skill_1_3()
{
base.DamageOfMin += 0.4f;
AttackCooldown += 0.05f;
}
/// <summary>
/// 每次攻击增加20%暴击率 射程减少1格"
/// </summary>
public override void Skill_1_5()
{
base.CriticalRate += 0.2f;
base.AttackRange = -1;
attack.SetAttackRange();
}
/// <summary>
/// 攻击CD减少25%
/// </summary>
public override void Skill_2_1()
{
base.AttackCooldown += -0.25f;
}
/// <summary>
/// 对小型敌人增加25%伤害射程减少1格
/// </summary>
public override void Skill_2_3()
{
base.DamageOfMin += 0.25f;
base.AttackRange = -1;
attack.SetAttackRange();
}
/// <summary>
/// 每次攻击增加20%暴击率攻击CD增加5%
/// </summary>
public override void Skill_2_5()
{
base.CriticalRate += 0.2f;
base.AttackCooldown += 0.05f;
}
}

View File

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

View File

@ -1,59 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class mmg_SkillUp : SkillUp
{
/// <summary>
///攻击CD减少25%
/// </summary>
public override void Skill_1_1()
{
base.AttackCooldown -= 0.25f;
}
/// <summary>
/// 射程提升2格位置攻击CD增加5%
/// </summary>
public override void Skill_1_3()
{
AttackCooldown += 0.05f;
base.AttackRange = 2;
attack.SetAttackRange();
}
/// <summary>
/// 增加子弹20%飞行速度攻击CD增加5%
/// </summary>
public override void Skill_1_5()
{
AttackCooldown += 0.05f;
base.attack.roleBulletSpeedAdd += 0.2f;
}
/// <summary>
/// 每次射击2个子弹增加扇形攻击范围
/// </summary>
public override void Skill_2_1()
{
base.attack.BulletNumber += 2;
base.attack.Angle += 20;
}
/// <summary>
/// 对小型敌人增加25%伤害攻击CD增加5%
/// </summary>
public override void Skill_2_3()
{
base.DamageOfMin += 0.25f;
AttackCooldown += 0.05f;
}
/// <summary>
/// 对小型敌人增加40%伤害攻击CD增加5%
/// </summary>
public override void Skill_2_5()
{
base.DamageOfMin += 0.4f;
base.AttackCooldown += 0.05f;
}
}

View File

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

View File

@ -1,59 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class qieSkillUp : SkillUp
{
/// <summary>
/// 攻击CD减少25%
/// </summary>
public override void Skill_1_1()
{
base.AttackCooldown += -0.25f;
}
/// <summary>
/// 增加子弹20%飞行速度。射程减少1格
/// </summary>
public override void Skill_1_3()
{
base.SpeedOfBullets += 0.2f;
base.AttackRange = -1;
attack.SetAttackRange();
}
/// <summary>
/// 对处于减速的敌人造成额外30%伤害。 攻击CD增加5%
/// </summary>
public override void Skill_1_5()
{
base.AttackCooldown += 0.05f;
base.DamageUp += 0.3f;
}
/// <summary>
/// 对空中敌人增加25%伤害
/// </summary>
public override void Skill_2_1()
{
base.DamageOfSky += 0.25f;
}
/// <summary>
/// 对小型敌人增加25%伤害。射程减少1格
/// </summary>
public override void Skill_2_3()
{
//base.AttackCooldown += 0.75f;
DamageOfMin += 0.25f;
base.AttackRange = -1;
attack.SetAttackRange();
}
/// <summary>
/// 每次攻击增加20%暴击率攻击CD增加5%
/// </summary>
public override void Skill_2_5()
{
Debug.Log("技能_2_5");
base.CriticalRate += 0.2f;
base.AttackCooldown += 0.05f;
}
}

View File

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

View File

@ -1,88 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
public class ssm_SkillUp : SkillUp
{
/// <summary>
/// 射程提升1格位置
/// </summary>
///
private float poisonDuration = 10;//中毒时间
private float poisonInterval = 2;//中毒间隔
private float poisonDamage = 10;//中毒伤害
Action<Role> decelerationBuff;
public override void Start()
{
base.Start();
decelerationBuff = CreatePoisonBuff(poisonDuration,poisonInterval,poisonDamage,role);
// 将 Buff 添加到玩家的 storageBuff 列表中
role.AddBuff(role.storageBuff, decelerationBuff);
}
public override void Skill_1_1()
{
base.AttackRange = 1;
attack.SetAttackRange();
}
/// <summary>
/// 攻击CD减少10%
/// </summary>
public override void Skill_1_3()
{
base.AttackCooldown += 0.1f;
}
/// <summary>
/// 每次扇形喷出3个毒雾攻击CD增加5%
/// </summary>
public override void Skill_1_5()
{
attack.BulletNumber = 3;
}
/// <summary>
/// 敌人中毒后受到伤害提升20%
/// </summary>
public override void Skill_2_1()
{
poisonDamage *= 1.2f;
SetPoisonBuff();
}
/// <summary>
/// 敌人中毒后毒药生效时间减少30% 攻击CD增加5%
/// </summary>
public override void Skill_2_3()
{
base.AttackCooldown += 0.05f;
poisonInterval *= 0.7f;
SetPoisonBuff();
}
/// <summary>
/// 敌人中毒后受到伤害提升50%,攻击CD增加5%
/// </summary>
public override void Skill_2_5()
{
base.AttackCooldown += 0.05f;
poisonDamage *= 1.5f;
SetPoisonBuff();
}
private void SetPoisonBuff()//重置buff
{
role.RemoveBuff(role.storageBuff, decelerationBuff);
decelerationBuff = CreatePoisonBuff(poisonDuration, poisonInterval, poisonDamage, role);
role.AddBuff(role.storageBuff, decelerationBuff);
}
}

View File

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

View File

@ -1,60 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ssy_SkillUp : SkillUp
{
/// <summary>
/// 冰冻子弹命中敌人后裂开为3个小子弹
/// </summary>
public override void Skill_1_1()
{
base.attack.splitNum = 3;
}
/// <summary>
/// 每个小子弹伤害增加30%攻击CD增加5%
/// </summary>
public override void Skill_1_3()
{
attack.SplitAttack *= (1 + 0.3f);
base.AttackCooldown += 0.05f;
}
/// <summary>
/// 每次射出2个子弹攻击CD增加5%
/// </summary>
public override void Skill_1_5()
{
attack.BulletNumber = 2;
base.AttackCooldown += 0.05f;
}
/// <summary>
/// 对小型敌人增加25%伤害
/// </summary>
public override void Skill_2_1()
{
base.DamageOfMin += 0.25f;
}
/// <summary>
/// 攻击CD减少25%射程减少1格
/// </summary>
public override void Skill_2_3()
{
base.AttackCooldown -= 0.25f;
base.AttackRange = -1;
attack.SetAttackRange();
}
/// <summary>
/// 对小型敌人增加25%伤害射程减少1格
/// </summary>
public override void Skill_2_5()
{
Debug.Log("技能_2_5");
base.DamageOfMin += 0.25f;
base.AttackRange = -1;
attack.SetAttackRange();
}
}

View File

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

View File

@ -1,63 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class txm_SkillUp : SkillUp
{
/// <summary>
///被巨石击中的敌人在3秒内速度减少50%
/// </summary>
public override void Skill_1_1()
{
// 创建一个眩晕 Buff持续1秒20%概率)
Action<Role> decelerationBuff = CreateSlowDownBuff(0.5f, 3f);
// 将 Buff 添加到玩家的 storageBuff 列表中
role.AddBuff(role.storageBuff, decelerationBuff);
}
/// <summary>
/// 巨石的溅伤范围增加1格,射程减少1格
/// </summary>
public override void Skill_1_3()
{
attack.BoomRange += 1;
base.AttackRange = -1;
attack.SetAttackRange();
}
/// <summary>
/// 被巨石击中的敌人在2秒内陷入眩晕状态无法移动,射程减少1格
/// </summary>
public override void Skill_1_5()
{
base.AttackRange = -1;
Action<Role> decelerationBuff=CreateDecelerationBuff(2f,1f);
role.AddBuff(role.storageBuff, decelerationBuff);
}
/// <summary>
/// 巨石飞行速度增加20%
/// </summary>
public override void Skill_2_1()
{
attack.roleBulletSpeedAdd += 0.2f;
}
/// <summary>
/// 攻击范围增加2格,攻击CD增加5%
/// </summary>
public override void Skill_2_3()
{
base.AttackRange = 2;
base.AttackCooldown += 0.05f;
attack.SetAttackRange();
}
/// <summary>
/// 巨石的溅伤范围增加1格,攻击CD增加5%
/// </summary>
public override void Skill_2_5()
{
attack.BoomRange += 1;
base.AttackCooldown += 0.05f;
}
}

View File

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

View File

@ -0,0 +1,45 @@
using LitJson;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Mengyao_Skill_Date : JsonReadBase
{
public TextAsset _Json;
public Dictionary<string, Dictionary<string, Dictionary<string, SkillLevelData>>> parsedData;
void Awake()
{
// 解析 JSON 数据
//parsedData = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, Dictionary<string, SkillLevelData>>>>(_Json.text.Trim());
}
void Start()
{
// 解析 JSON 数据
parsedData = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, Dictionary<string, SkillLevelData>>>>(_Json.text.Trim());
}
}
[System.Serializable]
public class SkillLevelData
{
public float DamageBuff = 0; // 伤害加成
public float Range = 0; // 攻击范围加成
public List<string> SkillList = null;//特效
public float AttackCooldown = 0; //攻击冷却
public float AttackContinues = 0; //攻击持续
public int numberOfBullets = 0;//攻击子弹数量加成
public int speedOfBullets = 0;//攻击子弹速度加成
public float CriticalRate = 0;//暴击率倍率加成
public float CriticalDamage = 0;//暴击伤害倍率加成
public float DamageOfSky = 0f;//对空伤害加成
public float DamageOfland = 0f;//对地伤害加成
public float DamageOfBig = 0f;//对大型敌人加成
public float DamageOfMin = 0f;//对小型型敌人加成
public float DamageOfSlow = 0f;//对减速敌人加成
}

View File

@ -1,9 +1,10 @@
fileFormatVersion: 2
guid: 7daf04d628022bd4aaac8e5b33e8d9b9
guid: 39d4d2c40e6ce1e45bb8069dc25b05e8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
defaultReferences:
- _Json: {fileID: 4900000, guid: 580cfe3a34ab71847870fa8a367f7e93, type: 3}
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 29b5ece7ff1f9c946aee00668809f293
guid: 59ba626460106f54f9a130de3914d56a
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -0,0 +1,316 @@
using System;
using System.Collections.Generic;
using System.Net.WebSockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using UnityEngine;
using Newtonsoft.Json;
using System.Drawing;
using UnityEngine.UI;
public class WebFishingPK : MonoBehaviour
{
private ClientWebSocket _webSocket;
private const string WebSocketUri = "ws://47.95.201.243:9527/api/ws";
private string AuthorizationValue;
/// <summary>
/// 倒计时
/// </summary>
private float lastCallTime = 0f;
float remainingTime = 0f;
public Text TimeText;
private float interval = 1f; // 每秒调用一次
private async void Start()
{
TimeText.gameObject.SetActive(false);
Debug.Log(PlayerPrefs.GetString("UserToken"));
AuthorizationValue = PlayerPrefs.GetString("UserToken");
await ConnectWebSocket();
// 调用发送方法
await SendJsonMessage("{ \"code\": \"FISHING_PK\", \"content\": \"{\\\"action\\\":\\\"INFO\\\"}\" }");
//await SendJsonMessage(30, 1);
}
private async Task ConnectWebSocket()
{
_webSocket = new ClientWebSocket();
// 添加 Authorization 头
_webSocket.Options.SetRequestHeader("Authorization", "Bearer " + AuthorizationValue);
try
{
Debug.Log("正在连接到 WebSocket...");
await _webSocket.ConnectAsync(new Uri(WebSocketUri), CancellationToken.None);
Debug.Log("WebSocket 连接成功!");
// 开始接收消息
_ = ReceiveMessages();
}
catch (Exception e)
{
Debug.LogError($"WebSocket 连接失败:{e.Message}");
}
}
private async Task ReceiveMessages()
{
var buffer = new byte[1024];
try
{
while (_webSocket.State == WebSocketState.Open)
{
var result = await _webSocket.ReceiveAsync(new ArraySegment<byte>(buffer), CancellationToken.None);
if (result.MessageType == WebSocketMessageType.Close)
{
Debug.Log("WebSocket 连接已被服务器关闭。");
await _webSocket.CloseAsync(WebSocketCloseStatus.NormalClosure, "关闭连接", CancellationToken.None);
}
else
{
var message = Encoding.UTF8.GetString(buffer, 0, result.Count);
Debug.Log($"接收到消息:{message}");
var baseResponse = JsonConvert.DeserializeObject<BaseResponse>(message);
Promptmgr.Instance.PromptBubble(baseResponse.message);
if (baseResponse != null)
{
switch (baseResponse.code)
{
// 解析消息为 钓手PK信息
case "FISHING_PK_INFO":
// 解析为 FishJoinroomresponse 类型
FishPKInforResponse fishResponse = JsonConvert.DeserializeObject<FishPKInforResponse>(message);
//Promptmgr.Instance.PromptBubble(fishResponse.message);
if (fishResponse?.data != null)
{
Debug.Log(fishResponse.data.balance);
Debug.Log(fishResponse.data.intro_text);
Debug.Log(fishResponse.data.countdown);
TimeText.gameObject.SetActive(true);
remainingTime = (float)fishResponse.data.countdown;
Debug.Log(fishResponse.data.countdown_type);
Debug.Log(fishResponse.data.amount_left);
Debug.Log(fishResponse.data.amount_right);
}
break;
//解析为钓手PK投入
case "FISHING_PK_BETTING":
// 解析消息为 Fishresponse 对象
FishPKBetonResponse fishResponse1 = JsonConvert.DeserializeObject<FishPKBetonResponse>(message);
Promptmgr.Instance.PromptBubble(fishResponse1.message);
// 检查是否成功反序列化
if (fishResponse1 != null && fishResponse1.data != null)
{
Debug.Log(fishResponse1.data.balance);
}
else
{
Debug.LogWarning("收到的消息无法解析为 Fishresponse 对象。");
}
break;
//解析为钓手Pk 倒计时
case "FISHING_PK_COUNTDOWN":
// 解析消息为 Fishresponse 对象
FishPKCDResponse fishResponse2 = JsonConvert.DeserializeObject<FishPKCDResponse>(message);
//Promptmgr.Instance.PromptBubble(fishResponse2.message);
// 检查是否成功反序列化
if (fishResponse2 != null && fishResponse2.data != null)
{
Debug.Log(fishResponse2.data.countdown);
remainingTime = (float)fishResponse2.data.countdown;
Debug.Log(fishResponse2.data.countdown_type);
Debug.Log(fishResponse2.data.amount_left);
Debug.Log(fishResponse2.data.amount_right);
}
else
{
Debug.LogWarning("收到的消息无法解析为 Fishresponse 对象。");
}
break;
case "FISHING_PK_SETTLE":
FishPKSETResponse fishResponse3 = JsonConvert.DeserializeObject<FishPKSETResponse>(message);
//Promptmgr.Instance.PromptBubble(fishResponse2.message);
// 检查是否成功反序列化
if (fishResponse3 != null && fishResponse3.data != null)
{
Debug.Log(fishResponse3.data.balance);
Debug.Log(fishResponse3.data.status);
Debug.Log(fishResponse3.data.amount);
Debug.Log(fishResponse3.data.reward);
Debug.Log(fishResponse3.data.weight_left);
Debug.Log(fishResponse3.data.weight_right);
Promptmgr.Instance.PromptBubble(fishResponse3.data.status);
}
else
{
Debug.LogWarning("收到的消息无法解析为 Fishresponse 对象。");
}
break;
}
}
}
}
}
catch (Exception e)
{
Debug.LogError($"接收消息时出错:{e.Message}");
}
}
public async Task SendJsonMessage(int count, int postion)
{
if (_webSocket == null || _webSocket.State != WebSocketState.Open)
{
Debug.LogError("WebSocket 未连接,无法发送消息。");
return;
}
try
{
var message = new
{
code = "FISHING_PK",
content = $"{{\"action\":\"BETTING\",\"amount\":{count},\"position\":{postion}}}"
};
// 将对象序列化为 JSON 字符串
string jsonMessage = JsonConvert.SerializeObject(message);
var encodedMessage = Encoding.UTF8.GetBytes(jsonMessage);
var buffer = new ArraySegment<byte>(encodedMessage);
await _webSocket.SendAsync(buffer, WebSocketMessageType.Text, true, CancellationToken.None);
Debug.Log($"已发送 JSON 消息:{jsonMessage}");
}
catch (Exception e)
{
Debug.LogError($"发送消息时出错:{e.Message}");
}
}
public async Task SendJsonMessage(string json)
{
if (_webSocket == null || _webSocket.State != WebSocketState.Open)
{
Debug.LogError("WebSocket 未连接,无法发送消息。");
return;
}
try
{
var encodedMessage = Encoding.UTF8.GetBytes(json);
var buffer = new ArraySegment<byte>(encodedMessage);
await _webSocket.SendAsync(buffer, WebSocketMessageType.Text, true, CancellationToken.None);
Debug.Log($"已发送 JSON 消息:{json}");
}
catch (Exception e)
{
Debug.LogError($"发送消息时出错:{e.Message}");
}
}
private async void OnApplicationQuit()
{
if (_webSocket != null && _webSocket.State == WebSocketState.Open)
{
await _webSocket.CloseAsync(WebSocketCloseStatus.NormalClosure, "应用程序退出", CancellationToken.None);
_webSocket.Dispose();
Debug.Log("WebSocket 连接已关闭。");
}
}
void UpdateCountdownText(float remainingTime)
{
// 将剩余时间转换为小时、分钟和秒
int hours = Mathf.FloorToInt(remainingTime / 3600);
int minutes = Mathf.FloorToInt((remainingTime % 3600) / 60);
int seconds = Mathf.FloorToInt(remainingTime % 60);
// 使用格式化字符串显示倒计时00:00:00
TimeText.text = "倒计时:"+string.Format("{0:D2}:{1:D2}:{2:D2}", hours, minutes, seconds);
}
private void Update()
{
if (Time.time - lastCallTime >= interval)
{
// 每秒调用一次的代码
if (remainingTime > 0)
{
remainingTime -= 1;
UpdateCountdownText(remainingTime);
Debug.Log("进入倒计时");
}
// 更新上次调用时间
lastCallTime = Time.time;
}
}
}
public class FishPKInforResponse
{
public string code { get; set; }
public string message { get; set; }
public FishPKInfor data { get; set; }
}
public class FishPKInfor
{
public float balance { get; set; }
public string intro_text { get; set; }
public int countdown { get; set; }
public int countdown_type { get; set; }
public float amount_left { get; set; }
public float amount_right { get; set; }
}
public class FishPKBetonResponse
{
public string code { get; set; }
public string message { get; set; }
public FishPKdata data { get; set; }
}
public class FishPKdata
{
public float balance { get; set; }
}
public class FishPKCDResponse
{
public string code { get; set; }
public string message { get; set; }
public FishPKCDdata data { get; set; }
}
public class FishPKCDdata
{
public int countdown { get; set; }
public int countdown_type { get; set; }
public float amount_left { get; set; }
public float amount_right { get; set; }
}
public class FishPKSETResponse
{
public string code { get; set; }
public string message { get; set; }
public FishPKSETdata data { get; set; }
}
public class FishPKSETdata
{
public float balance { get; set; }
public string status { get; set; }
public float amount { get; set; }
public float reward { get; set; }
public float weight_left { get; set; }
public float weight_right { get; set; }
}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: b8d04d25bab1a3541925d4cc205ad1d8
guid: 29b5ece7ff1f9c946aee00668809f293
MonoImporter:
externalObjects: {}
serializedVersion: 2