继续调整,创建 Procedure 与 Presentation 程序集
- 创建 Procedure 与 Presentation 两个程序集 - 初步解决这两个程序集与原程序集的引用关系
This commit is contained in:
@@ -7,5 +7,19 @@ namespace UI
|
||||
public string IconAssetName;
|
||||
public ItemRarity Rarity;
|
||||
public bool IsWeapon;
|
||||
|
||||
public DisplayItemContext()
|
||||
{
|
||||
IconAssetName = string.Empty;
|
||||
Rarity = ItemRarity.None;
|
||||
IsWeapon = false;
|
||||
}
|
||||
|
||||
public DisplayItemContext(DisplayItemRawData rawData)
|
||||
{
|
||||
this.IconAssetName = rawData.IconAssetName;
|
||||
this.Rarity = rawData.Rarity;
|
||||
this.IsWeapon = rawData.IsWeapon;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,5 +11,15 @@ namespace UI
|
||||
public Sprite Icon;
|
||||
public string Description;
|
||||
public int Price;
|
||||
|
||||
public GoodsItemContext(GoodsItemRawData rawData)
|
||||
{
|
||||
Title = rawData.Title;
|
||||
Description = rawData.Description;
|
||||
Price = rawData.Price;
|
||||
Rarity = rawData.Rarity;
|
||||
Type = rawData.Type;
|
||||
Icon = rawData.Icon;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,12 +51,18 @@ namespace UI
|
||||
|
||||
_rawData = rawData;
|
||||
|
||||
List<GoodsItemContext> goodsItems = new List<GoodsItemContext>();
|
||||
foreach (var item in rawData.GoodsItems)
|
||||
{
|
||||
goodsItems.Add(new GoodsItemContext(item));
|
||||
}
|
||||
|
||||
return new ShopFormContext
|
||||
{
|
||||
CurrentLevel = rawData.CurrentLevel,
|
||||
RefreshPrice = rawData.RefreshPrice,
|
||||
PlayerCoin = rawData.PlayerCoin,
|
||||
GoodsItems = rawData.GoodsItems,
|
||||
GoodsItems = goodsItems,
|
||||
PropListContext =
|
||||
BuildDisplayListAreaContext(DisplayListAreaType.Prop, rawData.PropItems, rawData.PropMaxCount),
|
||||
WeaponListContext = BuildDisplayListAreaContext(DisplayListAreaType.Weapon, rawData.WeaponItems,
|
||||
@@ -267,7 +273,18 @@ namespace UI
|
||||
return;
|
||||
}
|
||||
|
||||
Context.GoodsItems = result.GoodsItems;
|
||||
for (int i = 0; i < result.GoodsItems.Count; i++)
|
||||
{
|
||||
if (i < Context.GoodsItems.Count) Context.GoodsItems[i] = new GoodsItemContext(result.GoodsItems[i]);
|
||||
else Context.GoodsItems.Add(new GoodsItemContext(result.GoodsItems[i]));
|
||||
}
|
||||
|
||||
if (Context.GoodsItems.Count != result.GoodsItems.Count)
|
||||
{
|
||||
Context.GoodsItems.RemoveRange(Context.GoodsItems.Count,
|
||||
Context.GoodsItems.Count - Context.GoodsItems.Count);
|
||||
}
|
||||
|
||||
Context.RefreshPrice = result.RefreshPrice;
|
||||
|
||||
if (Form == null)
|
||||
@@ -276,8 +293,8 @@ namespace UI
|
||||
return;
|
||||
}
|
||||
|
||||
Form.RefreshGoodsItems(result.GoodsItems);
|
||||
Form.RefreshRefreshPrice(result.RefreshPrice);
|
||||
Form.RefreshGoodsItems(Context.GoodsItems);
|
||||
Form.RefreshRefreshPrice(Context.RefreshPrice);
|
||||
}
|
||||
|
||||
private void ApplyGoodsPurchased(ShopPurchaseResult result)
|
||||
@@ -299,19 +316,21 @@ namespace UI
|
||||
Context.GoodsItems[result.GoodsIndex] = null;
|
||||
}
|
||||
|
||||
DisplayItemContext context = new DisplayItemContext(result.DisplayItem);
|
||||
|
||||
if (result.DisplayItem != null)
|
||||
{
|
||||
if (result.DisplayItem.IsWeapon)
|
||||
{
|
||||
AppendDisplayItemContext(Context.WeaponListContext, result.DisplayItem);
|
||||
AppendDisplayItemContext(Context.WeaponListContext, context);
|
||||
}
|
||||
else
|
||||
{
|
||||
AppendDisplayItemContext(Context.PropListContext, result.DisplayItem);
|
||||
AppendDisplayItemContext(Context.PropListContext, context);
|
||||
}
|
||||
}
|
||||
|
||||
Form?.ApplyGoodsPurchased(result.GoodsIndex, result.DisplayItem);
|
||||
Form?.ApplyGoodsPurchased(result.GoodsIndex, context);
|
||||
}
|
||||
|
||||
private bool IsCurrentFormEventSender(object sender)
|
||||
|
||||
Reference in New Issue
Block a user