|
@@ -6,6 +6,13 @@ using ET;
|
|
|
|
|
|
namespace GFGGame
|
|
|
{
|
|
|
+ public enum DressUpOption
|
|
|
+ {
|
|
|
+ Auto,
|
|
|
+ Add,
|
|
|
+ Remove
|
|
|
+ }
|
|
|
+
|
|
|
public class DressUpObj
|
|
|
{
|
|
|
private GameObject _sceneObj;
|
|
@@ -81,7 +88,9 @@ namespace GFGGame
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- UpdateRoleView();
|
|
|
+ var tempData = DressUpDataClone();
|
|
|
+ TakeOffAll();
|
|
|
+ PutOnDressUpData(tempData);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -152,7 +161,7 @@ namespace GFGGame
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- public void AddOrRemove(int itemId, bool checkDefault, bool isAdd = false, bool isRemove = false)
|
|
|
+ public void AddOrRemove(int itemId, bool checkDefault, DressUpOption dressUpOption = DressUpOption.Auto)
|
|
|
{
|
|
|
int subType = ItemUtilCS.GetItemSubType(itemId);
|
|
|
if (subType == ConstDressUpItemType.BEI_JING)
|
|
@@ -162,14 +171,13 @@ namespace GFGGame
|
|
|
return;
|
|
|
}
|
|
|
_dressUpData.bgId = itemId;
|
|
|
- bool showAni = IsAction || DressUpMenuItemCfg1Array.Instance.CheckIsSceneType(itemId);
|
|
|
- DressUpUtil.AddItem(_dressUpData.bgId, _sceneObj, _needSetMask, showAni, _roleObj);
|
|
|
+ DressUpUtil.AddItem(_dressUpData.bgId, _sceneObj, _needSetMask, true, _roleObj);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (!CheckDressUpItemIsOn(itemId))
|
|
|
{
|
|
|
- if (!isRemove)
|
|
|
+ if (dressUpOption != DressUpOption.Remove)
|
|
|
{
|
|
|
if (checkDefault)
|
|
|
{
|
|
@@ -181,7 +189,7 @@ namespace GFGGame
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if (!isAdd)
|
|
|
+ if (dressUpOption != DressUpOption.Add)
|
|
|
{
|
|
|
Remove(itemId);
|
|
|
}
|
|
@@ -233,7 +241,7 @@ namespace GFGGame
|
|
|
_dressUpData.actionId = 0;
|
|
|
foreach (int itemID in itemList)
|
|
|
{
|
|
|
- AddOrRemove(itemID, false, false, true);
|
|
|
+ AddOrRemove(itemID, false, DressUpOption.Remove);
|
|
|
}
|
|
|
if (checkDefault)
|
|
|
{
|
|
@@ -274,12 +282,6 @@ namespace GFGGame
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //刷新视图,用于新设置sceneobj后的初始显示
|
|
|
- private void UpdateRoleView()
|
|
|
- {
|
|
|
- PutOnDressUpData(DressUpDataClone());
|
|
|
- }
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 尝试穿戴配置套装
|
|
|
/// </summary>
|
|
@@ -290,11 +292,7 @@ namespace GFGGame
|
|
|
/// <param name="CheckOwn">是否只显示主角拥有的部件</param>
|
|
|
public void PutOnSuitCfg(int id, bool tryShowAction, int[] excludeType = null, bool showOptional = true, bool CheckOwn = true)
|
|
|
{
|
|
|
- if (_dressUpData.suitId == id)
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
- TakeOffAll(false);
|
|
|
+ bool oldIsAction = IsAction;
|
|
|
_dressUpData.suitId = id;
|
|
|
bool hasSuitActionRes = DressUpMenuSuitDataManager.CheckSuitHasActionRes(_dressUpData.suitId);
|
|
|
_dressUpData.actionId = (hasSuitActionRes && tryShowAction) ? id : 0;
|
|
@@ -302,13 +300,14 @@ namespace GFGGame
|
|
|
List<int> items = new List<int>(suitCfg.partsArr);
|
|
|
if (showOptional)
|
|
|
{
|
|
|
-
|
|
|
if (suitCfg.partsOptionalArr != null && suitCfg.partsOptionalArr.Length > 0)
|
|
|
{
|
|
|
items.AddRange(suitCfg.partsOptionalArr);
|
|
|
}
|
|
|
}
|
|
|
int subType = 0;
|
|
|
+ //找到要穿的散件
|
|
|
+ List<int> targetItemList = new List<int>();
|
|
|
foreach (int itemId in items)
|
|
|
{
|
|
|
if (!CheckOwn || DressUpMenuItemDataManager.CheckHasItem(itemId))
|
|
@@ -319,11 +318,12 @@ namespace GFGGame
|
|
|
{
|
|
|
if (excludeType == null || Array.IndexOf(excludeType, subType) < 0)
|
|
|
{
|
|
|
- AddOrRemove(itemId, false, true);
|
|
|
+ targetItemList.Add(itemId);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ CompareAndAddItemList(oldIsAction, IsAction, targetItemList);
|
|
|
checkDefaultItem();
|
|
|
}
|
|
|
|
|
@@ -336,10 +336,16 @@ namespace GFGGame
|
|
|
{
|
|
|
foreach (int itemId in itemList)
|
|
|
{
|
|
|
- bool notInAction = SuitCfgArray.Instance.CheckItemNotInAction(itemId);
|
|
|
- if (!notInAction)
|
|
|
+ if(!DressUpMenuItemCfg1Array.Instance.CheckIsSceneType(itemId))
|
|
|
{
|
|
|
- AddOrRemove(itemId, false, false, true);
|
|
|
+ //场景类型不受动作影响并且本来就有动画,对非场景类型处理
|
|
|
+ AddOrRemove(itemId, false, DressUpOption.Remove);
|
|
|
+ bool notInAction = SuitCfgArray.Instance.CheckItemNotInAction(itemId);
|
|
|
+ if (notInAction)
|
|
|
+ {
|
|
|
+ //更新成动画模式
|
|
|
+ AddOrRemove(itemId, false, DressUpOption.Add);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -374,28 +380,41 @@ namespace GFGGame
|
|
|
bool notInAction = SuitCfgArray.Instance.CheckItemNotInAction(itemId);
|
|
|
if (!notInAction)
|
|
|
{
|
|
|
- AddOrRemove(itemId, false, true);
|
|
|
+ AddOrRemove(itemId, false, DressUpOption.Add);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- UpdateRoleView();
|
|
|
+ //更新非场景类型部件形态
|
|
|
+ foreach (int itemId in itemList)
|
|
|
+ {
|
|
|
+ if (!DressUpMenuItemCfg1Array.Instance.CheckIsSceneType(itemId))
|
|
|
+ {
|
|
|
+ //场景类型不受动作影响并且本来就有动画,对非场景类型处理
|
|
|
+ bool notInAction = SuitCfgArray.Instance.CheckItemNotInAction(itemId);
|
|
|
+ if (notInAction)
|
|
|
+ {
|
|
|
+ //更新成图片模式
|
|
|
+ AddOrRemove(itemId, false, DressUpOption.Add);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ checkDefaultItem();
|
|
|
}
|
|
|
|
|
|
//穿戴一组换装数据
|
|
|
- public void PutOnDressUpData(DressUpData dressUpData)
|
|
|
+ public void PutOnDressUpData(DressUpData targetDressUpData)
|
|
|
{
|
|
|
- TakeOffAll(false);
|
|
|
- _dressUpData.suitId = dressUpData.suitId;
|
|
|
- _dressUpData.actionId = dressUpData.actionId;
|
|
|
- if (dressUpData.bgId > 0)
|
|
|
- {
|
|
|
- AddOrRemove(dressUpData.bgId, false);
|
|
|
- }
|
|
|
- foreach (int itemID in dressUpData.itemList)
|
|
|
+ bool oldIsAction = IsAction;
|
|
|
+ _dressUpData.suitId = targetDressUpData.suitId;
|
|
|
+ _dressUpData.actionId = targetDressUpData.actionId;
|
|
|
+ var targetItemList = new List<int>();
|
|
|
+ targetItemList.AddRange(targetDressUpData.itemList);
|
|
|
+ if (targetDressUpData.bgId > 0)
|
|
|
{
|
|
|
- AddOrRemove(itemID, false, true);
|
|
|
+ targetItemList.Add(targetDressUpData.bgId);
|
|
|
}
|
|
|
+ CompareAndAddItemList(oldIsAction, IsAction, targetItemList);
|
|
|
checkDefaultItem();
|
|
|
|
|
|
}
|
|
@@ -406,14 +425,13 @@ namespace GFGGame
|
|
|
PutOnDressUpData(DressUpData.CreateDefault());
|
|
|
}
|
|
|
|
|
|
- //穿戴一组散件数据(会先脱掉原来的再穿)
|
|
|
- public void PutOnItemList(List<int> itemList)
|
|
|
+ //穿戴一组散件数据(会脱掉不包含的部分)
|
|
|
+ public void PutOnItemList(List<int> targetItemList)
|
|
|
{
|
|
|
- TakeOffAll(false);
|
|
|
- foreach (int itemID in itemList)
|
|
|
- {
|
|
|
- AddOrRemove(itemID, false, true);
|
|
|
- }
|
|
|
+ bool oldIsAction = IsAction;
|
|
|
+ _dressUpData.suitId = 0;
|
|
|
+ _dressUpData.actionId = 0;
|
|
|
+ CompareAndAddItemList(oldIsAction, IsAction, targetItemList);
|
|
|
checkDefaultItem();
|
|
|
}
|
|
|
|
|
@@ -469,6 +487,33 @@ namespace GFGGame
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //与身上的散件对比差异然后添加
|
|
|
+ private void CompareAndAddItemList(bool oldIsAction, bool newIsAction, List<int> targetItemList)
|
|
|
+ {
|
|
|
+ bool actionStatusChanged = (oldIsAction && !newIsAction) || (!oldIsAction && newIsAction);
|
|
|
+ foreach (int itemID in itemList)
|
|
|
+ {
|
|
|
+ if (!targetItemList.Contains(itemID))
|
|
|
+ {
|
|
|
+ //移除不穿的部件
|
|
|
+ AddOrRemove(itemID, false, DressUpOption.Remove);
|
|
|
+ }
|
|
|
+ else if (actionStatusChanged)
|
|
|
+ {
|
|
|
+ //当动画形态切换时
|
|
|
+ if (!DressUpMenuItemCfg1Array.Instance.CheckIsSceneType(itemID))
|
|
|
+ {
|
|
|
+ //非场景类型重穿
|
|
|
+ AddOrRemove(itemID, false, DressUpOption.Remove);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ foreach (int itemID in targetItemList)
|
|
|
+ {
|
|
|
+ AddOrRemove(itemID, false, DressUpOption.Add);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//检测当前穿戴是否是一件完整套装,且只穿了一件套装,返回套装id
|
|
|
private int CheckCurDressIsSuit()
|
|
|
{
|