增加指挥官技能释放区域颜色可配置

main
刘涛 2023-12-12 13:33:58 +08:00
parent bf71970370
commit 2ace43af8f
8 changed files with 117 additions and 19 deletions

View File

@ -42,7 +42,7 @@ namespace Framework
public static JSONNode LoadByteBuf(string file)
{
DebugUtil.LogY("TableManager LoadByteBuf {0}", file);
// DebugUtil.LogY("TableManager LoadByteBuf {0}", file);
// todo: load from asset loader
var filePath = string.Format(Constants.DATA_FORMAT_PATH, file);
var loadAsset = AssetDatabase.LoadAssetAtPath<TextAsset>(filePath);

View File

@ -2,7 +2,9 @@
using Framework;
using Gameplay.Area;
using Gameplay.Common;
using Gameplay.Effect;
using Gameplay.Level;
using Gameplay.Utils;
using LTGame;
using UnityEngine;
namespace Gameplay.PlayerSkill.State
@ -21,6 +23,10 @@ namespace Gameplay.PlayerSkill.State
private AreaChecker _checker = new AreaChecker();
private EffectPlayingData _effectData;
private Color _areaColor;
public PlayerSkillStateChoosePos(PlayerSkillManager owner) : base(owner, EPlayerSkillState.ChoosePos)
{
@ -41,6 +47,15 @@ namespace Gameplay.PlayerSkill.State
_map.ShowInfo(Map.InfoMask.ShowCells, true);
if (owner.readySkillConfig.ShowEffectId > 0)
{
_effectData = EffectManager.instance.PlayEffectById(owner.readySkillConfig.ShowEffectId, Vector3.zero);
_effectData.autoDestroy = false;
}
_areaColor = ColorEx.FromStr(owner.readySkillConfig.ShowAreaColor);
EventManager.Instance.Register<EDReleasePlayerSkill>(EventManager.EventName.INFIGHT_PLAYER_SKILL_RELEASE, _OnRecvRelease);
}
@ -63,7 +78,12 @@ namespace Gameplay.PlayerSkill.State
_cacheAreaCellIndexs.Clear();
AreaManager.instance.GetCellIndexs(_lastMouseCellIndex, owner.readySkillConfig.ShowAreaId, _cacheAreaCellIndexs);
_map.SetBlocksColor(_cacheAreaCellIndexs, true, Color.green);
if (_effectData != null)
{
_effectData.transform.position = AreaManager.instance.GetCellPosByIndex(_lastMouseCellIndex);
}
_map.SetBlocksColor(_cacheAreaCellIndexs, true, _areaColor);
}
_FakeInput();
@ -81,6 +101,12 @@ namespace Gameplay.PlayerSkill.State
}
_map.ShowInfo(Map.InfoMask.ShowCells, false);
if (_effectData != null)
{
_effectData.Destroy();
_effectData = null;
}
EventManager.Instance.Unregister<EDReleasePlayerSkill>(EventManager.EventName.INFIGHT_PLAYER_SKILL_RELEASE, _OnRecvRelease);
}
@ -113,7 +139,7 @@ namespace Gameplay.PlayerSkill.State
nextState = EPlayerSkillState.Idle;
return;
}
DebugUtil.Log("玩家释放技能");
owner.selectedCellIndex = _lastMouseCellIndex;
nextState = EPlayerSkillState.Release;

View File

@ -0,0 +1,19 @@
using UnityEngine;
namespace Gameplay.Utils
{
public static class ColorEx
{
public static Color FromStr(string str,
Color defaultColor = default)
{
if (UnityEngine.ColorUtility.TryParseHtmlString(str, out var result))
{
return result;
}
return defaultColor;
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 90024fbbbdac45d6be9e6fd869ea562f
timeCreated: 1702359039

View File

@ -0,0 +1,17 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace cfg.ActorCfg
{
public enum ShopRefreshType
{
None = 0,
}
}

View File

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

View File

@ -29,10 +29,11 @@ public sealed partial class DataPlayerSkill : Bright.Config.BeanBase
{ if(!_json["InfluenceAreaId"].IsNumber) { throw new SerializationException(); } InfluenceAreaId = _json["InfluenceAreaId"]; }
{ if(!_json["ShowAreaId"].IsNumber) { throw new SerializationException(); } ShowAreaId = _json["ShowAreaId"]; }
{ if(!_json["ShowEffectId"].IsNumber) { throw new SerializationException(); } ShowEffectId = _json["ShowEffectId"]; }
{ if(!_json["ShowAreaColor"].IsString) { throw new SerializationException(); } ShowAreaColor = _json["ShowAreaColor"]; }
PostInit();
}
public DataPlayerSkill(int ID, string Name, int SkillGroup, float CDTime, int LogicActionId, System.Collections.Generic.List<float> FloatParams, int PreSelectType, SkillCfg.EReleaseCheckType ReleaseCheckType, int InfluenceAreaId, int ShowAreaId, int ShowEffectId )
public DataPlayerSkill(int ID, string Name, int SkillGroup, float CDTime, int LogicActionId, System.Collections.Generic.List<float> FloatParams, int PreSelectType, SkillCfg.EReleaseCheckType ReleaseCheckType, int InfluenceAreaId, int ShowAreaId, int ShowEffectId, string ShowAreaColor )
{
this.ID = ID;
this.Name = Name;
@ -45,6 +46,7 @@ public sealed partial class DataPlayerSkill : Bright.Config.BeanBase
this.InfluenceAreaId = InfluenceAreaId;
this.ShowAreaId = ShowAreaId;
this.ShowEffectId = ShowEffectId;
this.ShowAreaColor = ShowAreaColor;
PostInit();
}
@ -97,6 +99,10 @@ public sealed partial class DataPlayerSkill : Bright.Config.BeanBase
/// 显示的特效id
/// </summary>
public int ShowEffectId { get; private set; }
/// <summary>
/// 显示区域的颜色
/// </summary>
public string ShowAreaColor { get; private set; }
public const int __ID__ = 68915787;
public override int GetTypeId() => __ID__;
@ -124,6 +130,7 @@ public sealed partial class DataPlayerSkill : Bright.Config.BeanBase
+ "InfluenceAreaId:" + InfluenceAreaId + ","
+ "ShowAreaId:" + ShowAreaId + ","
+ "ShowEffectId:" + ShowEffectId + ","
+ "ShowAreaColor:" + ShowAreaColor + ","
+ "}";
}

View File

@ -12,7 +12,8 @@
"ReleaseCheckType": 3,
"InfluenceAreaId": 1,
"ShowAreaId": 1,
"ShowEffectId": 0
"ShowEffectId": 0,
"ShowAreaColor": "#ffff00"
},
{
"ID": 112,
@ -27,7 +28,8 @@
"ReleaseCheckType": 5,
"InfluenceAreaId": 2,
"ShowAreaId": 2,
"ShowEffectId": 0
"ShowEffectId": 0,
"ShowAreaColor": "#ffff00"
},
{
"ID": 121,
@ -42,7 +44,8 @@
"ReleaseCheckType": 0,
"InfluenceAreaId": 1,
"ShowAreaId": 1,
"ShowEffectId": 0
"ShowEffectId": 0,
"ShowAreaColor": "#ffff00"
},
{
"ID": 211,
@ -58,7 +61,8 @@
"ReleaseCheckType": 0,
"InfluenceAreaId": 1,
"ShowAreaId": 2,
"ShowEffectId": 2
"ShowEffectId": 2,
"ShowAreaColor": "#ffff00"
},
{
"ID": 221,
@ -71,7 +75,8 @@
"ReleaseCheckType": 0,
"InfluenceAreaId": 1,
"ShowAreaId": 1,
"ShowEffectId": 0
"ShowEffectId": 0,
"ShowAreaColor": "#ffff00"
},
{
"ID": 231,
@ -84,7 +89,8 @@
"ReleaseCheckType": 0,
"InfluenceAreaId": 1,
"ShowAreaId": 1,
"ShowEffectId": 0
"ShowEffectId": 0,
"ShowAreaColor": "#ffff00"
},
{
"ID": 311,
@ -99,7 +105,8 @@
"ReleaseCheckType": 0,
"InfluenceAreaId": 1,
"ShowAreaId": 1,
"ShowEffectId": 0
"ShowEffectId": 0,
"ShowAreaColor": "#ffff00"
},
{
"ID": 321,
@ -114,7 +121,8 @@
"ReleaseCheckType": 0,
"InfluenceAreaId": 1,
"ShowAreaId": 1,
"ShowEffectId": 0
"ShowEffectId": 0,
"ShowAreaColor": "#ffff00"
},
{
"ID": 1001,
@ -127,7 +135,8 @@
"ReleaseCheckType": 1,
"InfluenceAreaId": 1,
"ShowAreaId": 1,
"ShowEffectId": 0
"ShowEffectId": 0,
"ShowAreaColor": "#ffff00"
},
{
"ID": 1002,
@ -140,7 +149,8 @@
"ReleaseCheckType": 3,
"InfluenceAreaId": 1,
"ShowAreaId": 1,
"ShowEffectId": 0
"ShowEffectId": 0,
"ShowAreaColor": "#ffff00"
},
{
"ID": 1003,
@ -153,7 +163,8 @@
"ReleaseCheckType": 6,
"InfluenceAreaId": 1,
"ShowAreaId": 1,
"ShowEffectId": 0
"ShowEffectId": 0,
"ShowAreaColor": "#ffff00"
},
{
"ID": 2001,
@ -166,7 +177,8 @@
"ReleaseCheckType": 2,
"InfluenceAreaId": 1,
"ShowAreaId": 1,
"ShowEffectId": 0
"ShowEffectId": 0,
"ShowAreaColor": "#ffff00"
},
{
"ID": 2002,
@ -179,7 +191,8 @@
"ReleaseCheckType": 0,
"InfluenceAreaId": 1,
"ShowAreaId": 1,
"ShowEffectId": 0
"ShowEffectId": 0,
"ShowAreaColor": "#ffff00"
},
{
"ID": 3001,
@ -192,7 +205,8 @@
"ReleaseCheckType": 0,
"InfluenceAreaId": 1,
"ShowAreaId": 1,
"ShowEffectId": 0
"ShowEffectId": 0,
"ShowAreaColor": "#ffff00"
},
{
"ID": 3002,
@ -205,6 +219,7 @@
"ReleaseCheckType": 0,
"InfluenceAreaId": 1,
"ShowAreaId": 1,
"ShowEffectId": 0
"ShowEffectId": 0,
"ShowAreaColor": "#ffff00"
}
]