增加星魂按位置具体分类

develope
Cal 2021-05-14 15:28:23 +08:00
parent 9b8c779e9b
commit 6cb2165ccd
35 changed files with 420 additions and 223 deletions

View File

@ -6,10 +6,10 @@
<relation target="" sidePair="width-width,height-height"/>
</image>
<image id="n2_tc2r" name="btn" src="tc2rtm1" fileName="Assets/NPC_jimai_xiala.png" xy="82,0" size="29,24">
<relation target="" sidePair="width-width,height-height,right-right,top-top"/>
<relation target="" sidePair="height-height,right-right,leftext-left"/>
</image>
<text id="n1_tc2r" name="title" xy="0,0" size="82,25" fontSize="14" vAlign="middle" autoSize="none" singleLine="true" text="">
<relation target="" sidePair="width-width,height-height"/>
<relation target="" sidePair="height-height,left-left,rightext-right"/>
</text>
</displayList>
<ComboBox dropdown="ui://71ktouo7tc2rtm6"/>

View File

@ -72,22 +72,22 @@
</component>
<text id="n26_jxet" name="n26" xy="455,464" size="36,24" group="n27_jxet" fontSize="15" color="#ffcc33" autoSize="none" strokeColor="#000000" text="位置"/>
<group id="n27_jxet" name="n27" xy="431,464" size="60,24"/>
<component id="n28_jxet" name="n28" src="i7y3kx" fileName="ButtonOnlyTextSingle.xml" pkg="kqsmrpxl" xy="243,509" size="38,25">
<component id="n28_jxet" name="n28" src="i7y3kx" fileName="ButtonOnlyTextSingle.xml" pkg="kqsmrpxl" xy="96,510" size="38,25">
<Button checked="true" title="普通" controller="quality" page="0"/>
</component>
<component id="n29_jxet" name="n29" src="i7y3kx" fileName="ButtonOnlyTextSingle.xml" pkg="kqsmrpxl" xy="286,509" size="38,25">
<component id="n29_jxet" name="n29" src="i7y3kx" fileName="ButtonOnlyTextSingle.xml" pkg="kqsmrpxl" xy="139,510" size="38,25">
<Button title="非凡" controller="quality" page="1"/>
</component>
<component id="n30_jxet" name="n30" src="i7y3kx" fileName="ButtonOnlyTextSingle.xml" pkg="kqsmrpxl" xy="329,509" size="38,25">
<component id="n30_jxet" name="n30" src="i7y3kx" fileName="ButtonOnlyTextSingle.xml" pkg="kqsmrpxl" xy="182,510" size="38,25">
<Button title="稀有" controller="quality" page="2"/>
</component>
<component id="n31_jxet" name="n31" src="i7y3kx" fileName="ButtonOnlyTextSingle.xml" pkg="kqsmrpxl" xy="372,509" size="38,25">
<component id="n31_jxet" name="n31" src="i7y3kx" fileName="ButtonOnlyTextSingle.xml" pkg="kqsmrpxl" xy="225,510" size="38,25">
<Button title="史诗" controller="quality" page="3"/>
</component>
<component id="n32_jxet" name="n32" src="i7y3kx" fileName="ButtonOnlyTextSingle.xml" pkg="kqsmrpxl" xy="415,509" size="38,25">
<component id="n32_jxet" name="n32" src="i7y3kx" fileName="ButtonOnlyTextSingle.xml" pkg="kqsmrpxl" xy="268,510" size="38,25">
<Button title="传奇" controller="quality" page="4"/>
</component>
<component id="n33_jxet" name="n33" src="i7y3kx" fileName="ButtonOnlyTextSingle.xml" pkg="kqsmrpxl" xy="458,509" size="38,25">
<component id="n33_jxet" name="n33" src="i7y3kx" fileName="ButtonOnlyTextSingle.xml" pkg="kqsmrpxl" xy="311,510" size="38,25">
<Button title="天工" controller="quality" page="5"/>
</component>
<component id="n34_th4y" name="btnTime" src="czagl" fileName="ButtonSingle.xml" pkg="kqsmrpxl" xy="307,467" size="19,19" group="n36_th4y" aspect="true">
@ -95,6 +95,23 @@
</component>
<text id="n35_th4y" name="n35" xy="331,464" size="36,24" group="n36_th4y" fontSize="15" color="#ffcc33" autoSize="none" strokeColor="#000000" text="时间"/>
<group id="n36_th4y" name="n36" xy="307,464" size="60,24"/>
<component id="n37_lz9h" name="comBoxPos" src="tc2rtm7" fileName="ComboBox.xml" xy="424,510" size="70,24">
<gearDisplay controller="sortType" pages="2"/>
<ComboBox visibleItemCount="10">
<item title="武器"/>
<item title="背景"/>
<item title="形象"/>
<item title="护腕"/>
<item title="勋章"/>
<item title="戒指"/>
<item title="帽子"/>
<item title="项链"/>
<item title="上衣"/>
<item title="裤子"/>
<item title="手套"/>
<item title="鞋"/>
</ComboBox>
</component>
</displayList>
<transition name="Effect">
<item time="0" type="Alpha" target="n18_fyvb" tween="true" startValue="0" endValue="1" duration="18"/>

View File

@ -2952,6 +2952,15 @@ message M2C_GetStarSoulBag // IActorLocationResponse
repeated int64 usedIdMap =2;
repeated KV_int32_int32 suitKVs =5;
}
message M2C_SyncStarSoulBagInfo // IActorMessage
{
int32 RpcId = 90;
int64 ActorId = 93;
repeated StarSoulNetItem itemList=1;
repeated int64 usedIdMap =2;
repeated KV_int32_int32 suitKVs =5;
int64 UnitId=3;
}
message M2C_SyncStarSoulBag // IActorMessage
{
int32 RpcId = 90;

View File

@ -10,44 +10,8 @@ namespace ET
protected override async ETTask Run(Unit unit, C2M_GetStarSoulBag request, M2C_GetStarSoulBag response, Action reply)
{
StarSoulBag bag = unit.GetComponent<StarSoulBag>();
foreach (var kv in bag.itemDic)
{
try
{
StarSoulNetItem netItem = new();
StarSoulItem item = kv.Value;
netItem.Id = item.Id;
netItem.level = item.level;
netItem.exp = item.exp;
netItem.quality = (int) item.quality;
netItem.posType = (int) item.posType;
netItem.typeId = item.typeId;
netItem.isUsed = item.isUsed;
netItem.main = item.mainId;
netItem.isLocked = item.isLocked;
foreach (int id in item.viceIds)
{
netItem.vice.Add(id);
}foreach (float id in item.viceAdd)
{
netItem.viceAdd.Add(id);
}
response.itemList.Add(netItem);
}
catch (Exception e)
{
Log.Error(e);
}
}
response.usedIdMap.AddRange(bag.usedStarSoulDic.Values);
foreach (StarSoulSuit starSoulSuit in bag.Suits)
{
response.suitKVs.Add(new KV_int32_int32()
{
key = starSoulSuit.Id,
value = (int) starSoulSuit.type
});
}
bag.GetBagInfo(response.itemList,response.usedIdMap,response.suitKVs);
reply();
await ETTask.CompletedTask;
}

View File

@ -20,9 +20,7 @@ namespace ET
}
if (request.Id != unit.Id)
{
M2C_SyncUnitAttributeList message = CharacterHelper.GetSyncUnitAttributeList(unitGet);
message.UnitId = request.Id;
MessageHelper.SendActor(unit, message);
await CharacterHelper.SyncUnitInfo(unit,unitGet);
}
response.UnitCharacter =await CharacterHelper.GetUnitCharacter(unitGet);
BagHelper.GetWornEquipInfo(unitGet, response.WornBagMapList);

View File

@ -619,5 +619,28 @@ namespace ET
unitSkillComponent.TransferJob(jobType);
await UserComponent.Instance.Save(user);
}
public static async ETTask SyncUnitInfo(Unit unit, Unit target)
{
await ETTask.CompletedTask;
//同步num
SyncTargetNumInfo(unit,target);
SyncTargetStarSoulInfo(unit,target);
}
private static void SyncTargetNumInfo(Unit unit, Unit target)
{
M2C_SyncUnitAttributeList message = CharacterHelper.GetSyncUnitAttributeList(target);
message.UnitId = target.Id;
MessageHelper.SendActor(unit, message);
}
private static void SyncTargetStarSoulInfo(Unit unit, Unit target)
{
M2C_SyncStarSoulBagInfo message = new M2C_SyncStarSoulBagInfo() { UnitId = target.Id};
StarSoulBag bag = target.GetComponent<StarSoulBag>();
bag.GetBagInfo(message.itemList,message.usedIdMap,message.suitKVs);
MessageHelper.SendActor(unit, message);
}
}
}

View File

@ -131,6 +131,11 @@ namespace ET
return itemBase;
}
/// <summary>
/// 同步已经使用的星魂
/// </summary>
/// <param name="self"></param>
/// <param name="key"></param>
private static void Sync(this StarSoulBag self,byte key)
{
self.usedStarSoulDic.TryGetValue(key, out long value);
@ -147,10 +152,16 @@ namespace ET
}
MessageHelper.SendActor(self.GetParent<Unit>(), proto);
}
/// <summary>
/// 同步背包
/// </summary>
/// <param name="self"></param>
/// <param name="Id"></param>
/// <param name="item"></param>
private static void Sync(this StarSoulBag self, long Id, StarSoulItem item)
{
M2C_SyncStarSoulBag proto = new();
StarSoulNetItem netItem = new StarSoulNetItem();
StarSoulNetItem netItem = new();
if (item == null)
{
netItem.Id = 0;
@ -182,6 +193,47 @@ namespace ET
MessageHelper.SendActor(self.GetParent<Unit>(), proto);
}
public static void GetBagInfo(this StarSoulBag self, List<StarSoulNetItem> itemList, List<long> usedIdMap, List<KV_int32_int32> suitKVs)
{
foreach (var kv in self.itemDic)
{
try
{
StarSoulNetItem netItem = new();
StarSoulItem item = kv.Value;
netItem.Id = item.Id;
netItem.level = item.level;
netItem.exp = item.exp;
netItem.quality = (int) item.quality;
netItem.posType = (int) item.posType;
netItem.typeId = item.typeId;
netItem.isUsed = item.isUsed;
netItem.main = item.mainId;
netItem.isLocked = item.isLocked;
foreach (int id in item.viceIds)
{
netItem.vice.Add(id);
}foreach (float id in item.viceAdd)
{
netItem.viceAdd.Add(id);
}
itemList.Add(netItem);
}
catch (Exception e)
{
Log.Error(e);
}
}
usedIdMap.AddRange(self.usedStarSoulDic.Values);
foreach (StarSoulSuit starSoulSuit in self.Suits)
{
suitKVs.Add(new KV_int32_int32()
{
key = starSoulSuit.Id,
value = (int) starSoulSuit.type
});
}
}
private static string AddExp(this StarSoulBag self, StarSoulItem item, List<(int, int)> expList, ref int needCount)
{
if (item == null)

View File

@ -3,78 +3,87 @@ using System.Collections.Generic;
namespace ET
{
public class DelaySendSyncAttributeComponentAwakeSystem : AwakeSystem<DelaySendSyncAttributeComponent>
public class DelaySendSyncAttributeComponentAwakeSystem: AwakeSystem<DelaySendSyncAttributeComponent>
{
public override void Awake(DelaySendSyncAttributeComponent self)
{
DelaySendSyncAttributeComponent.instance = self;
}
}
public class DelaySendSyncAttributeComponentUpdateSystem : UpdateSystem<DelaySendSyncAttributeComponent>
public class DelaySendSyncAttributeComponentUpdateSystem: UpdateSystem<DelaySendSyncAttributeComponent>
{
private HashSet<long> needRemoveSet = new HashSet<long>();
public override void Update(DelaySendSyncAttributeComponent self)
{
foreach (KeyValuePair<long, List<KeyValuePair<int, float>>> item in self.dic.GetDictionary())
{
needRemoveSet.Add(item.Key);
List<KeyValuePair<int, float>> list = item.Value;
Unit unit = MapUnitComponent.Instance.Get(item.Key);
if (!unit)
try
{
if (unit!=null && Math.Abs(unit.Id) < 100000)
needRemoveSet.Add(item.Key);
List<KeyValuePair<int, float>> list = item.Value;
Unit unit = MapUnitComponent.Instance.Get(item.Key);
if (!unit)
{
Log.Error($"unit is invalid where id = {item.Key} ");
foreach (KeyValuePair<int, float> kv in item.Value)
if (unit != null && Math.Abs(unit.Id) < 100000)
{
Log.Error($"k = {(NumericType)kv.Key}, v ={kv.Value}");
Log.Error($"unit is invalid where id = {item.Key} ");
foreach (KeyValuePair<int, float> kv in item.Value)
{
Log.Error($"k = {(NumericType) kv.Key}, v ={kv.Value}");
}
}
continue;
}
if (list.Count == 0) continue;
IActorMessage message = null;
switch (list.Count)
{
case > 1:
{
M2C_SyncUnitAttributeList newMessage = new() { UnitId = unit.Id };
foreach (KeyValuePair<int, float> kv in list)
{
newMessage.NumericMap.Add(new AttributeMap { Key = kv.Key, Value = kv.Value });
}
message = newMessage;
break;
}
case 1:
{
KeyValuePair<int, float> kv = list[0];
message = new M2C_SyncUnitAttribute { UnitId = unit.Id, NumericType = kv.Key, Value = kv.Value };
break;
}
}
continue;
}
IActorMessage message = null;
if (list.Count > 1)
{
M2C_SyncUnitAttributeList newMessage = new M2C_SyncUnitAttributeList
{
UnitId = unit.Id
};
foreach (KeyValuePair<int, float> kv in list)
{
newMessage.NumericMap.Add(new AttributeMap
{
Key = kv.Key,
Value = kv.Value
});
}
message = newMessage;
}
else if (list.Count == 1)
{
KeyValuePair<int, float> kv = list[0];
message = new M2C_SyncUnitAttribute
{
UnitId = unit.Id,
NumericType = kv.Key,
Value = kv.Value
};
}
if (message != null)
unit.GetComponent<BrocastComponent>().BrocastInterval(message);
if (message != null)
unit.GetComponent<BrocastComponent>().BrocastInterval(message);
}
catch (Exception e)
{
Log.Error(e);
}
}
foreach (long item in needRemoveSet)
{
self.dic.Remove(item);
}
needRemoveSet.Clear();
}
}
public static class DelaySendSyncAttributeComponentSystem
{
public static void Add(this DelaySendSyncAttributeComponent self, Unit unit, NumericType numericType, float value)
{
self.dic.Add(unit.Id, KeyValuePair.Create((int)numericType, value));
self.dic.Add(unit.Id, KeyValuePair.Create((int) numericType, value));
}
}
}
}

View File

@ -93,5 +93,6 @@ namespace ET
[BsonIgnore]
public Func<AttributeType, float> getAttributeFunc { get; set; }
}
}

View File

@ -7073,6 +7073,33 @@ namespace ET
[ProtoMember(5)]
public List<KV_int32_int32> suitKVs = new List<KV_int32_int32>();
[ProtoMember(3)]
public long UnitId { get; set; }
}
[Message(OuterOpcode.M2C_SyncStarSoulBagInfo)]
[ProtoContract]
public partial class M2C_SyncStarSoulBagInfo:IActorMessage
{
[ProtoMember(90)]
public int RpcId { get; set; }
[ProtoMember(93)]
public long ActorId { get; set; }
[ProtoMember(1)]
public List<StarSoulNetItem> itemList = new List<StarSoulNetItem>();
[ProtoMember(2)]
public List<long> usedIdMap = new List<long>();
[ProtoMember(5)]
public List<KV_int32_int32> suitKVs = new List<KV_int32_int32>();
[ProtoMember(3)]
public long UnitId { get; set; }
}
[Message(OuterOpcode.M2C_SyncStarSoulBag)]

View File

@ -402,16 +402,17 @@ namespace ET
public const ushort KV_int32_int32 = 20398;
public const ushort KV_string_int32 = 20399;
public const ushort M2C_GetStarSoulBag = 20400;
public const ushort M2C_SyncStarSoulBag = 20401;
public const ushort M2C_SyncStarSoulBagItemUsed = 20402;
public const ushort C2M_UpgradeStarSoulItem = 20403;
public const ushort M2C_UpgradeStarSoulItem = 20404;
public const ushort C2M_PutonStarSoulItem = 20405;
public const ushort M2C_PutonStarSoulItem = 20406;
public const ushort C2M_LockStarSoulItem = 20407;
public const ushort C2M_StartActive = 20408;
public const ushort M2C_StartActive = 20409;
public const ushort C2M_GetUIDByName = 20410;
public const ushort M2C_GetUIDByName = 20411;
public const ushort M2C_SyncStarSoulBagInfo = 20401;
public const ushort M2C_SyncStarSoulBag = 20402;
public const ushort M2C_SyncStarSoulBagItemUsed = 20403;
public const ushort C2M_UpgradeStarSoulItem = 20404;
public const ushort M2C_UpgradeStarSoulItem = 20405;
public const ushort C2M_PutonStarSoulItem = 20406;
public const ushort M2C_PutonStarSoulItem = 20407;
public const ushort C2M_LockStarSoulItem = 20408;
public const ushort C2M_StartActive = 20409;
public const ushort M2C_StartActive = 20410;
public const ushort C2M_GetUIDByName = 20411;
public const ushort M2C_GetUIDByName = 20412;
}
}

View File

@ -10,7 +10,8 @@ namespace ET
protected override async ETVoid Run(ET.Session session, M2C_SyncStarSoulBag message)
{
var zoneScene = session.ZoneScene();
StarSoulBag bag = zoneScene.GetComponent<StarSoulBag>();
var unit = zoneScene.GetComponent<UnitComponent>().MyUnit;
StarSoulBag bag = unit.GetComponent<StarSoulBag>();
var item = message.item;
if (item.Id == 0)
{

View File

@ -0,0 +1,25 @@
using System;
using UnityEngine;
namespace ET
{
[MessageHandler]
public class M2C_SyncStarSoulBagInfoHandler:AMHandler<M2C_SyncStarSoulBagInfo>
{
protected override async ETVoid Run(Session session, M2C_SyncStarSoulBagInfo message)
{
try
{
var zoneScene = session.ZoneScene();
var unit = zoneScene.GetComponent<UnitComponent>().Get(message.UnitId);
StarSoulBag bag = unit.GetComponent<StarSoulBag>();
bag.FillData(message.itemList,message.usedIdMap,message.suitKVs);
}
catch (Exception e)
{
Log.Error(e);
}
}
}
}

View File

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

View File

@ -10,7 +10,8 @@ namespace ET
protected override async ETVoid Run(ET.Session session, M2C_SyncStarSoulBagItemUsed message)
{
var zoneScene = session.ZoneScene();
StarSoulBag bag = zoneScene.GetComponent<StarSoulBag>();
var unit = zoneScene.GetComponent<UnitComponent>().MyUnit;
StarSoulBag bag = unit.GetComponent<StarSoulBag>();
bag.usedStarSoulDic[(byte) message.key] = message.value;
bag.Suits.Clear();
foreach (KV_int32_int32 kv in message.suitKVs)

View File

@ -5,7 +5,10 @@
public static async ETTask Start(this GetInfoComponent self)
{
await TimerComponent.Instance.WaitAsync(1000);
self.ZoneScene().GetComponent<StarSoulBag>().InitData();
// var unit = self.ZoneScene().GetComponent<UnitComponent>().MyUnit;
var unit = self.ZoneScene().GetComponent<UnitComponent>().MyUnit;
StarSoulBag bag = unit.GetComponent<StarSoulBag>();
unit.GetComponent<StarSoulBag>().InitData();
}
}
}

View File

@ -10,7 +10,6 @@ namespace ET
{
public override void Awake(StarSoulBag self)
{
}
}
@ -34,7 +33,7 @@ namespace ET
{
public static void InitData(this StarSoulBag self)
{
#if UNITY
#if UNITY
GetDataFromServer(self).Coroutine();
#endif
}
@ -47,16 +46,25 @@ namespace ET
Game.EventSystem.Publish(new ShowTipUI() { tip = ret.Message, tipType = TipType.Single, isClearIpt = true, });
return;
}
for (var i = 0; i < ret.usedIdMap.Count; i++)
self.FillData(ret.itemList, ret.usedIdMap, ret.suitKVs);
}
public static void FillData(this StarSoulBag self, List<StarSoulNetItem> itemList, List<long> usedIdMap, List<KV_int32_int32> suitKVs)
{
for (var i = 0; i < usedIdMap.Count; i++)
{
self.usedStarSoulDic[(byte) i] = ret.usedIdMap[i];
self.usedStarSoulDic[(byte) i] = usedIdMap[i];
}
self.Suits.Clear();
foreach (KV_int32_int32 kv in ret.suitKVs)
foreach (KV_int32_int32 kv in suitKVs)
{
self.Suits.Add(new StarSoulSuit(){Id = kv.key,type = (StarSoulSuit.StarSoulSuitType) kv.value});
self.Suits.Add(new StarSoulSuit() { Id = kv.key, type = (StarSoulSuit.StarSoulSuitType) kv.value });
}
foreach (StarSoulNetItem starSoulNetItem in ret.itemList)
foreach (StarSoulNetItem starSoulNetItem in itemList)
{
try
{
@ -75,20 +83,21 @@ namespace ET
for (var i = 0; i < starSoulNetItem.vice.Count; i++)
{
item.viceAttribute[i] = starSoulNetItem.vice[i];
}
}
for (var i = 0; i < starSoulNetItem.viceAdd.Count; i++)
{
item.viceAdd[i] = starSoulNetItem.viceAdd[i];
}
self.Add(item);
}
catch (Exception e)
{
Debug.Log(e);
Log.Error(e);
}
}
}
public static bool CanAdd(this StarSoulBag self)
{
return self.ItemCount < StarSoulBag.MaxCount;
@ -99,7 +108,7 @@ namespace ET
if (!self.CanAdd()) return "星魂背包已满";
if (self.itemDic.ContainsKey(item.Id))
{
#if SERVER
#if SERVER
Log.Error($"{self.Id.GetPlayerFormatName()} serverId 重复 {item.Id}");
#endif
return "系统错误";
@ -109,19 +118,21 @@ namespace ET
self.ItemCount++;
return null;
}
public static string Update(this StarSoulBag self,StarSoulItem item)
public static string Update(this StarSoulBag self, StarSoulItem item)
{
if (!self.itemDic.ContainsKey(item.Id))
{
return Add(self,item);
return Add(self, item);
}
self.itemDic[item.Id] = item;
return null;
}
public static bool Remove(this StarSoulBag self, long Id)
{
if(! self.itemDic.Remove(Id))
if (!self.itemDic.Remove(Id))
{
return false;
}
@ -136,6 +147,7 @@ namespace ET
{
return null;
}
return itemBase;
}
}

View File

@ -29,6 +29,7 @@ namespace ET
unit.AddComponent<NumericComponent>();
unit.AddComponent<Pet>();
unit.AddComponent<BuffComponent>();
unit.AddComponent<StarSoulBag>();
#if ROBOT
unit.AddComponent<TeamHandleComponent>();
#endif
@ -53,7 +54,8 @@ namespace ET
await Game.EventSystem.Publish(new ET.EventType.OnCreateUnit { zoneScene = zoneScene, unit = unit, prefabId = prefabId });
return unit;
} public static async ETTask<Unit> Create(Scene zoneScene, long id, int prefabId, UnitType unitType)
}
public static async ETTask<Unit> Create(Scene zoneScene, long id, int prefabId, UnitType unitType)
{
UnitComponent unitComponent = zoneScene.GetComponent<UnitComponent>();
Unit unit = EntityFactory.CreateWithParentAndId<Unit>(unitComponent, id);

View File

@ -7073,6 +7073,33 @@ namespace ET
[ProtoMember(5)]
public List<KV_int32_int32> suitKVs = new List<KV_int32_int32>();
[ProtoMember(3)]
public long UnitId { get; set; }
}
[Message(OuterOpcode.M2C_SyncStarSoulBagInfo)]
[ProtoContract]
public partial class M2C_SyncStarSoulBagInfo:IActorMessage
{
[ProtoMember(90)]
public int RpcId { get; set; }
[ProtoMember(93)]
public long ActorId { get; set; }
[ProtoMember(1)]
public List<StarSoulNetItem> itemList = new List<StarSoulNetItem>();
[ProtoMember(2)]
public List<long> usedIdMap = new List<long>();
[ProtoMember(5)]
public List<KV_int32_int32> suitKVs = new List<KV_int32_int32>();
[ProtoMember(3)]
public long UnitId { get; set; }
}
[Message(OuterOpcode.M2C_SyncStarSoulBag)]

View File

@ -402,16 +402,17 @@ namespace ET
public const ushort KV_int32_int32 = 20398;
public const ushort KV_string_int32 = 20399;
public const ushort M2C_GetStarSoulBag = 20400;
public const ushort M2C_SyncStarSoulBag = 20401;
public const ushort M2C_SyncStarSoulBagItemUsed = 20402;
public const ushort C2M_UpgradeStarSoulItem = 20403;
public const ushort M2C_UpgradeStarSoulItem = 20404;
public const ushort C2M_PutonStarSoulItem = 20405;
public const ushort M2C_PutonStarSoulItem = 20406;
public const ushort C2M_LockStarSoulItem = 20407;
public const ushort C2M_StartActive = 20408;
public const ushort M2C_StartActive = 20409;
public const ushort C2M_GetUIDByName = 20410;
public const ushort M2C_GetUIDByName = 20411;
public const ushort M2C_SyncStarSoulBagInfo = 20401;
public const ushort M2C_SyncStarSoulBag = 20402;
public const ushort M2C_SyncStarSoulBagItemUsed = 20403;
public const ushort C2M_UpgradeStarSoulItem = 20404;
public const ushort M2C_UpgradeStarSoulItem = 20405;
public const ushort C2M_PutonStarSoulItem = 20406;
public const ushort M2C_PutonStarSoulItem = 20407;
public const ushort C2M_LockStarSoulItem = 20408;
public const ushort C2M_StartActive = 20409;
public const ushort M2C_StartActive = 20410;
public const ushort C2M_GetUIDByName = 20411;
public const ushort M2C_GetUIDByName = 20412;
}
}

View File

@ -21,7 +21,6 @@ namespace ET
zoneScene.AddComponent<HideUnitComponent>();
zoneScene.AddComponent<ChatMessageComponent>();
zoneScene.AddComponent<GetInfoComponent>();
zoneScene.AddComponent<StarSoulBag>();
// UI层的初始化
//await Game.EventSystem.Publish(new EventType.AfterCreateZoneScene() { zoneScene = zoneScene });

View File

@ -25,32 +25,32 @@ namespace ET
_attributeDic["职业"].text = unitCharacter.Job;
_attributeDic["家族"].text = unitCharacter.Family;
_attributeDic["等级"].text = CharacterHelper.GetLevelString(unit);
_attributeDic["经验"].text = MathHelper.FloatToIntString(num.Get(NumericType.Exp));
_attributeDic["经验"].text = num.Get(NumericType.Exp).FloatToIntString();
_attributeDic["力量"].text = MathHelper.FloatToIntString(num.Get(NumericType.Str));
_attributeDic["智慧"].text = MathHelper.FloatToIntString(num.Get(NumericType.Wim));
_attributeDic["体质"].text = MathHelper.FloatToIntString(num.Get(NumericType.Phy));
_attributeDic["耐力"].text = MathHelper.FloatToIntString(num.Get(NumericType.Sta));
_attributeDic["敏捷"].text = MathHelper.FloatToIntString(num.Get(NumericType.Quk));
_attributeDic["精神"].text = MathHelper.FloatToIntString(num.Get(NumericType.Spi));
_attributeDic["力量"].text = num.Get(NumericType.Str).FloatToIntString();
_attributeDic["智慧"].text = num.Get(NumericType.Wim).FloatToIntString();
_attributeDic["体质"].text = num.Get(NumericType.Phy).FloatToIntString();
_attributeDic["耐力"].text = num.Get(NumericType.Sta).FloatToIntString();
_attributeDic["敏捷"].text = num.Get(NumericType.Quk).FloatToIntString();
_attributeDic["精神"].text = num.Get(NumericType.Spi).FloatToIntString();
_attributeDic["生命"].text = $"{MathHelper.FloatToIntString(num.Get(NumericType.Hp))}/{ MathHelper.FloatToIntString(num.Get(NumericType.MaxHp))}";
_attributeDic["精力"].text = $"{MathHelper.FloatToIntString(num.Get(NumericType.Mp))}/{MathHelper.FloatToIntString(num.Get(NumericType.MaxMp))}";
_attributeDic["物理攻击"].text = MathHelper.FloatToIntString(num.Get(NumericType.PhyAtk));
_attributeDic["精神攻击"].text = MathHelper.FloatToIntString(num.Get(NumericType.SpiAtk));
_attributeDic["物理防御"].text = MathHelper.FloatToIntString(num.Get(NumericType.PhyDef));
_attributeDic["精神防御"].text = MathHelper.FloatToIntString(num.Get(NumericType.SpiDef));
_attributeDic["物理暴击率"].text = MathHelper.FloatToPercentString(num.Get(NumericType.Pcrir));
_attributeDic["精神暴击率"].text = MathHelper.FloatToPercentString(num.Get(NumericType.Mcrir));
_attributeDic["物理暴击值"].text = MathHelper.FloatToPercentString(num.Get(NumericType.Pcri));
_attributeDic["精神暴击值"].text = MathHelper.FloatToPercentString(num.Get(NumericType.Mcri));
_attributeDic["抗物理暴击率"].text = MathHelper.FloatToPercentString(num.Get(NumericType.Rpcrir));
_attributeDic["抗精神暴击率"].text = MathHelper.FloatToPercentString(num.Get(NumericType.Rmcrir));
_attributeDic["抗物理暴击值"].text = MathHelper.FloatToPercentString(num.Get(NumericType.Rpcri));
_attributeDic["抗精神暴击值"].text = MathHelper.FloatToPercentString(num.Get(NumericType.Rmcri));
_attributeDic["物理免伤"].text = MathHelper.FloatToPercentString(num.Get(NumericType.Nphyi));
_attributeDic["精神免伤"].text = MathHelper.FloatToPercentString(num.Get(NumericType.Nmeni));
_attributeDic["辅助值"].text = MathHelper.FloatToPercentString(num.Get(NumericType.Dvo));
_attributeDic["生命"].text = $"{num.Get(NumericType.Hp).FloatToIntString()}/{ num.Get(NumericType.MaxHp).FloatToIntString()}";
_attributeDic["精力"].text = $"{num.Get(NumericType.Mp).FloatToIntString()}/{num.Get(NumericType.MaxMp).FloatToIntString()}";
_attributeDic["物理攻击"].text = num.Get(NumericType.PhyAtk).FloatToIntString();
_attributeDic["精神攻击"].text = num.Get(NumericType.SpiAtk).FloatToIntString();
_attributeDic["物理防御"].text = num.Get(NumericType.PhyDef).FloatToIntString();
_attributeDic["精神防御"].text = num.Get(NumericType.SpiDef).FloatToIntString();
_attributeDic["物理暴击率"].text = num.Get(NumericType.Pcrir).FloatToPercentString();
_attributeDic["精神暴击率"].text = num.Get(NumericType.Mcrir).FloatToPercentString();
_attributeDic["物理暴击值"].text = num.Get(NumericType.Pcri).FloatToPercentString();
_attributeDic["精神暴击值"].text = num.Get(NumericType.Mcri).FloatToPercentString();
_attributeDic["抗物理暴击率"].text = num.Get(NumericType.Rpcrir).FloatToPercentString();
_attributeDic["抗精神暴击率"].text = num.Get(NumericType.Rmcrir).FloatToPercentString();
_attributeDic["抗物理暴击值"].text = num.Get(NumericType.Rpcri).FloatToPercentString();
_attributeDic["抗精神暴击值"].text = num.Get(NumericType.Rmcri).FloatToPercentString();
_attributeDic["物理免伤"].text = num.Get(NumericType.Nphyi).FloatToPercentString();
_attributeDic["精神免伤"].text = num.Get(NumericType.Nmeni).FloatToPercentString();
_attributeDic["辅助值"].text = num.Get(NumericType.Dvo).FloatToPercentString();
//!更新属性点
FUI_CharacterUI characterUI = FUIComponent.Instance.Get(FUIPackage.Character_CharacterUI)?.As<FUI_CharacterUI>();

View File

@ -145,15 +145,18 @@ namespace ET
action = context.sender.As<GObject>().data as EventCallback0;
token?.Cancel();
token = new ETCancellationToken();
bool ret = await TimerComponent.Instance.WaitAsync(350, token);
var ret = await TimerComponent.Instance.WaitAsync(350, token);
if (ret)
action?.Invoke();
}
private static readonly List<string> itemDescList = new List<string>();
private static readonly string SpaceLine3 = "[size=3] [/size]";
public static void OpenUI(ClientItemData data, bool isComprasion = true)
public static void OpenUI(Scene zoneScene, ClientItemData data, bool isComprasion = true, long unitId = 0)
{
bool isMine = unitId == 0;
Unit unit = unitId == 0? zoneScene.GetComponent<UnitComponent>().MyUnit : zoneScene.GetComponent<UnitComponent>().Get(unitId);
ClientItemData wornEquipData = null;
sb.Length = 0;
itemDescList.Clear();
@ -205,7 +208,7 @@ namespace ET
sb.AppendFormat($"[color=#ff99cc]{isLock}[/color]\n");
sb.AppendFormat($"需要等级:{equipBase.UseLevel}\n");
sb.AppendFormat($"需要职业: {GetStrJob(equipBase.JobId, equipBase.Transmigration)}\n");
sb.AppendLine("[size=3] [/size]");
sb.AppendLine(SpaceLine3);
itemDescList.Clear();
GetEquipSpecialAtrribute(data.Equip, itemDescList);
foreach (string item in itemDescList)
@ -213,7 +216,7 @@ namespace ET
sb.AppendFormat($"[color=#99bf88]{item}[/color]\n");
}
sb.AppendLine("[size=3] [/size]");
sb.AppendLine(SpaceLine3);
itemDescList.Clear();
GetEquipBaseAtrribute(data.Equip, equipBase, itemDescList);
foreach (string item in itemDescList)
@ -221,7 +224,7 @@ namespace ET
sb.AppendFormat($"[color=#99bf88]{item}[/color]\n");
}
sb.AppendLine("[size=3] [/size]");
sb.AppendLine(SpaceLine3);
itemDescList.Clear();
GetEquipAdditionalAtrribute(data.Equip, itemDescList);
foreach (string item in itemDescList)
@ -259,11 +262,12 @@ namespace ET
}
}
StarSoulBag bag = FUI_TabUI.ZoneScene().GetComponent<StarSoulBag>();
StarSoulBag bag = unit.GetComponent<StarSoulBag>();
long starSoulId = bag.usedStarSoulDic[(byte) index];
if (starSoulId != 0)
{
sb.AppendLine("[size=3] [/size]");
sb.AppendLine(SpaceLine3);
sb.AppendLine("----星魂----");
starSoulString = GenerateStarSoulString(sb, bag, starSoulId, needReturn: true);
}
@ -341,7 +345,7 @@ namespace ET
sb.AppendFormat($"[color=#ff99cc]已绑定[/color]\n");
sb.AppendFormat($"需要等级:{equipBase.UseLevel}\n");
sb.AppendFormat($"需要职业: {GetStrJob(equipBase.JobId, equipBase.Transmigration)}\n");
sb.AppendLine("[size=3] [/size]");
sb.AppendLine(SpaceLine3);
itemDescList.Clear();
GetEquipSpecialAtrribute(wornEquipData.Equip, itemDescList);
foreach (string item in itemDescList)
@ -349,7 +353,7 @@ namespace ET
sb.AppendFormat($"[color=#99bf88]{item}[/color]\n");
}
sb.AppendLine("[size=3] [/size]");
sb.AppendLine(SpaceLine3);
itemDescList.Clear();
GetEquipBaseAtrribute(wornEquipData.Equip, equipBase, itemDescList);
foreach (string item in itemDescList)
@ -357,7 +361,7 @@ namespace ET
sb.AppendFormat($"[color=#99bf88]{item}[/color]\n");
}
sb.AppendLine("[size=3] [/size]");
sb.AppendLine(SpaceLine3);
itemDescList.Clear();
GetEquipAdditionalAtrribute(wornEquipData.Equip, itemDescList);
foreach (string item in itemDescList)
@ -383,9 +387,10 @@ namespace ET
sb.AppendLine($"来源:[color=#ffff00][i]{wornEquipData.getSource}[/i][/color]");
}
if (starSoulString != null)
{
sb.AppendLine("[size=3] [/size]");
sb.AppendLine(SpaceLine3);
sb.AppendLine("----星魂----");
sb.Append(starSoulString);
}
@ -419,12 +424,12 @@ namespace ET
}
StarSoulAttributeConfig soulAttributeConfig = StarSoulAttributeConfigCategory.Instance.Get(starSoulItem.mainAttribute);
sb.AppendLine("[size=3] [/size]");
sb.AppendLine(SpaceLine3);
sb.AppendLine("固定属性:");
sb.AppendLine(
$"[color=#99bf88]{GetAttributeString((Cal.AttributeType) soulAttributeConfig.Key, ItemHelper.GetRealMainValue(soulAttributeConfig.Value, starSoulItem.level))}[/color]");
sb.AppendLine("[size=3] [/size]");
sb.AppendLine(SpaceLine3);
sb.AppendLine("随机属性:");
for (var i = 0; i < starSoulItem.viceAttribute.Length; i++)
{
@ -436,15 +441,15 @@ namespace ET
$"[color=#99bf88]{GetAttributeString((Cal.AttributeType) soulAttributeConfig.Key, ItemHelper.GetRealViceValue(soulAttributeConfig.Value * (1 + starSoulItem.viceAdd[i]), starSoulItem.quality))}[/color]");
}
sb.AppendLine("[size=3] [/size]");
sb.AppendLine(SpaceLine3);
sb.AppendLine("套装属性:");
StarSoulSuit suit = bag.Suits.Find(t => t.Id == starSoulItem.typeId);
string color = "#999999";
if (suit!=null&&suit.type.HasFlag(StarSoulSuit.StarSoulSuitType.Suit4))
if (suit != null && suit.type.HasFlag(StarSoulSuit.StarSoulSuitType.Suit4))
color = "#ccee00";
sb.AppendLine($"[color={color}]4件套\n {starSoulTypeConfig.Suit4}[/color]");
color = "#999999";
if (suit!=null&&suit.type.HasFlag(StarSoulSuit.StarSoulSuitType.Suit8))
if (suit != null && suit.type.HasFlag(StarSoulSuit.StarSoulSuitType.Suit8))
color = "#cc9900";
if (!starSoulTypeConfig.Suit8.IsNullOrEmpty())
{
@ -763,7 +768,7 @@ namespace ET
sb.AppendFormat($"[color=#ff99cc]{isLock}[/color]\n");
sb.AppendFormat($"需要等级:{equipBase.UseLevel}\n");
sb.AppendFormat($"需要职业: {GetStrJob(equipBase.JobId, equipBase.Transmigration)}\n");
sb.AppendLine("[size=3] [/size]");
sb.AppendLine(SpaceLine3);
itemDescList.Clear();
GetEquipSpecialAtrribute(equipBase, itemDescList);
foreach (string item in itemDescList)
@ -771,7 +776,7 @@ namespace ET
sb.AppendFormat($"[color=#99bf88]{item}[/color]\n");
}
sb.AppendLine("[size=3] [/size]");
sb.AppendLine(SpaceLine3);
itemDescList.Clear();
GetEquiBaseAtrribute(equipBase, itemDescList);
foreach (string item in itemDescList)
@ -979,7 +984,7 @@ namespace ET
GenerateStarSoulString(sb, bag, id, true);
StarSoulItem data = bag.Get(id);
sb.AppendLine("[size=3] [/size]");
sb.AppendLine(SpaceLine3);
sb.Append("[color=#ffff99]星魂可以通过消耗其他星魂进行升级升级会提升固定属性每升级4级产生或者强化某一个随机属性[/color]");
FUI_TabUI ui = OpenUI();
ui.m_title.text = sb.ToString();
@ -1003,7 +1008,7 @@ namespace ET
sb.Length = 0;
GenerateStarSoulString(sb, bag, usedId);
sb.AppendLine("[size=3] [/size]");
sb.AppendLine(SpaceLine3);
sb.Append("[color=#ffff99]星魂可以通过消耗其他星魂进行升级升级会提升固定属性每升级4级产生或者强化某一个随机属性[/color]");
comUI.m_title.text = sb.ToString();
}

View File

@ -34,6 +34,7 @@ namespace ET
public FUI_ButtonSingle m_btnType;
public FUI_ButtonSingle m_btnPosType;
public FUI_ButtonSingle m_btnTime;
public FUI_ComboBox m_comBoxPos;
public Transition m_Effect;
public const string URL = "ui://71ktouo7f0oatmn";
@ -118,6 +119,7 @@ namespace ET
m_btnType = FUI_ButtonSingle.Create(domain,com.GetChildAt(4));
m_btnPosType = FUI_ButtonSingle.Create(domain,com.GetChildAt(6));
m_btnTime = FUI_ButtonSingle.Create(domain,com.GetChildAt(14));
m_comBoxPos = FUI_ComboBox.Create(domain,com.GetChildAt(16));
m_Effect = com.GetTransitionAt(0);
}
}
@ -143,6 +145,8 @@ public override void Dispose()
m_btnType = null;
m_btnPosType = null;
m_btnTime = null;
m_comBoxPos.Dispose();
m_comBoxPos = null;
m_Effect = null;
}
}

View File

@ -74,7 +74,7 @@ namespace ET
{
if (ClientItemDataComponent.Instance.ItemDic.TryGetValueByKey1(temp, out ClientItemData data))
{
TabHelper.OpenUI(data);
TabHelper.OpenUI(zoneScene,data);
}
});
//!隐藏页签

View File

@ -228,7 +228,9 @@ namespace ET
{
if (ClientItemDataComponent.Instance.WornEquipDic.TryGetValue(index, out ClientItemData data))
{
TabHelper.OpenUI(data, false);
var gv = zoneScene.GetComponent<GlobalVariable>();
long selectUnitId=gv.IsMineCharacter?0:gv.SelectUnitId;
TabHelper.OpenUI(zoneScene,data, false,selectUnitId);
}
});
}

View File

@ -245,7 +245,7 @@ namespace ET
{
if (ClientItemDataComponent.Instance.ConsignmentDic.TryGetValue(temp, out ConsignmentItemData __data))
{
TabHelper.OpenUI(__data);
TabHelper.OpenUI(zoneScene,__data);
}
});
//!隐藏页签

View File

@ -38,6 +38,7 @@ namespace ET
private bool isInit;
private SortType sortType = SortType.Time;
private Quality sortQuality = Quality.Common;
private EquipType equipType = EquipType.;
private List<long> list = new List<long>();
private LinkedList<StarSoulItem> tempList = new LinkedList<StarSoulItem>();
@ -61,7 +62,7 @@ namespace ET
private async ETVoid AwakeAsync()
{
bag ??= this.zoneScene.GetComponent<StarSoulBag>();
bag ??= this.zoneScene.GetComponent<UnitComponent>().MyUnit.GetComponent<StarSoulBag>();
ShowSlots();
await ETTask.CompletedTask;
}
@ -95,10 +96,10 @@ namespace ET
long id = list[index];
clickEvent?.Invoke(id);
});
#else
#else
btn.self.onRollOver.Set(() =>EquipStarSoul(data, id));
#endif
btn.self.onRightClick.Set(() =>EquipStarSoul(data, id));
btn.self.onRightClick.Set(() => EquipStarSoul(data, id));
btn.m_btnLock.self.onClick.Set1(context =>
{
context.StopPropagation();
@ -161,6 +162,13 @@ namespace ET
{
this.ui.m_sortType.onChanged.Set(SortTypeChanged);
this.ui.m_quality.onChanged.Set(QualityTypeChanged);
ui.m_comBoxPos.self.onChanged.Set(ChangeEquipPos);
}
private void ChangeEquipPos()
{
this.equipType = (EquipType) this.ui.m_comBoxPos.self.selectedIndex;
ReFresh();
}
private void SortTypeChanged()
@ -184,6 +192,7 @@ namespace ET
if (item.quality == this.sortQuality)
this.list.Add(item.Id);
}
if (this.sortType == SortType.Time)
{
return;
@ -199,6 +208,13 @@ namespace ET
continue;
}
if (this.sortType == SortType.PosType)
{
//排除
if (item.posType != this.equipType)
continue;
}
var curr = this.tempList.First;
if (curr == null)
{

View File

@ -65,7 +65,8 @@ namespace ET
RegisterEvent();
}
StarSoulBagUI.clickEvent += OnBagUIClick;
this.bag ??= this.zoneScene.GetComponent<StarSoulBag>();
var gv = this.zoneScene.GetComponent<GlobalVariable>();
bag ??= this.zoneScene.GetComponent<UnitComponent>().MyUnit.GetComponent<StarSoulBag>();
selectedId.Clear();
await ETTask.CompletedTask;
}
@ -127,7 +128,8 @@ namespace ET
else
{
int index = selectedId.IndexOf(id);
bag ??= this.zoneScene.GetComponent<StarSoulBag>();
var gv = this.zoneScene.GetComponent<GlobalVariable>();
bag ??= this.zoneScene.GetComponent<UnitComponent>().MyUnit.GetComponent<StarSoulBag>();
if (index != -1)
{
this.selectedId.RemoveAt(index);
@ -164,7 +166,6 @@ namespace ET
}
private void ShowBefore()
{
StarSoulBag bag = this.zoneScene.GetComponent<StarSoulBag>();
var data = bag.Get(id);
if (data == null)
{
@ -179,7 +180,6 @@ namespace ET
private void ShowAfter()
{
StarSoulBag bag = this.zoneScene.GetComponent<StarSoulBag>();
var data = bag.Get(id);
if (data == null)
{

View File

@ -115,35 +115,29 @@ namespace ET
{
if (ClientItemDataComponent.Instance.StoreItemDic.TryGetValue(temp, out ClientItemData data))
{
TabHelper.OpenUI(data);
TabHelper.OpenUI(zoneScene,data);
}
});
#if UNITY_STANDALONE
//!右键
btn.onRightClick.Set1(async context =>
{
if (context.inputEvent.isDoubleClick)
if (!context.inputEvent.isDoubleClick) return;
if (zoneScene.GetComponent<UnitComponent>().MyUnit.IsFight)
{
if (zoneScene.GetComponent<UnitComponent>().MyUnit.IsFight)
{
TipHelper.OpenUI("战斗中,不能使用!");
return;
}
if (ClientItemDataComponent.Instance.StoreItemDic.TryGetValue(temp, out ClientItemData data))
{
if (data.ItemType != ItemType.NoneItem)
{
BagUI bagUI = FUIComponent.Instance.Get(FUIPackage.Bag_BagUI)?.GetComponent<BagUI>();
if (bagUI != null)
{
if (BagUI.isMulti)
await SendPutOutProto(temp, data.Count);
else
await SendPutOutProto(temp, 1);
}
}
}
TipHelper.OpenUI("战斗中,不能使用!");
return;
}
if (!ClientItemDataComponent.Instance.StoreItemDic.TryGetValue(temp, out ClientItemData data))
return;
if (data.ItemType == ItemType.NoneItem) return;
var bagUI = FUIComponent.Instance.Get(FUIPackage.Bag_BagUI)?.GetComponent<BagUI>();
if (bagUI == null) return;
if (BagUI.isMulti)
await SendPutOutProto(temp, data.Count);
else
await SendPutOutProto(temp, 1);
});
#endif
//!拖拽
@ -184,11 +178,9 @@ namespace ET
async void TipYesCallBack()
{
if (long.TryParse(tipUI.m_IptTxt.text, out long count))
{
if (count <= 0) return;
await SendPutProto(count);
}
if (!long.TryParse(tipUI.m_IptTxt.text, out long count)) return;
if (count <= 0) return;
await SendPutProto(count);
}
async ETTask SendPutProto(long count)
{
@ -210,11 +202,9 @@ namespace ET
async void TipYesCallBack()
{
if (long.TryParse(tipUI.m_IptTxt.text, out long count))
{
if (count <= 0) return;
await SendPutProto(count);
}
if (!long.TryParse(tipUI.m_IptTxt.text, out long count)) return;
if (count <= 0) return;
await SendPutProto(count);
}
async ETTask SendPutProto(long count)
{
@ -238,10 +228,7 @@ namespace ET
return;
}
string str = null;
if (query.Coin != 0)
str = $"是否花费{query.Coin / 10000}金币扩展仓库!";
else
str = $"是否花费{query.Voucher}代金券扩展仓库!";
str = query.Coin != 0 ? $"是否花费{query.Coin / 10000}金币扩展仓库!" : $"是否花费{query.Voucher}代金券扩展仓库!";
FUI_TipUI tipUI = TipHelper.OpenUI(str, tipType: TipType.Double);
tipUI.m_btnYes.self.onClick.Clear();
tipUI.m_btnYes.self.onClick.Add(async () =>