feat(battle-engine): close the AI-simulation subsystem (verbatim)

Copied the 89 uncopied AI*SimulationUtility/extension files defining the
AIVirtualCard/AIVirtualField extension methods; the compile loop then auto-closed
the revealed type deps (~3049 files total, drift-clean). 10.0k -> 62 errors.
This commit is contained in:
gamer147
2026-06-05 20:30:59 -04:00
parent 78f310c2b3
commit 824309ec44
472 changed files with 55870 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
using LitJson;
namespace Wizard.Lottery;
public class DoubleChanceData
{
public int RequireNum { get; private set; }
public LotteryRewardData RewardData { get; private set; }
public DoubleChanceData(JsonData data)
{
RequireNum = data["require_num"].ToInt();
RewardData = new LotteryRewardData(data);
}
}

View File

@@ -0,0 +1,127 @@
using System;
using System.Collections.Generic;
using LitJson;
namespace Wizard.Lottery;
public class LotteryInfoTask : BaseTask
{
public class LotteryInfoData
{
public List<LotteryRewardData> LotteryRewardList;
public List<LotteryMissionData> LotteryMissionList;
public List<LotteryRewardData> MissionRewardList;
public LotteryRewardData BigChanceReward;
public int CampaignId { get; private set; }
public string InfoUrl { get; private set; }
public DateTime StartTime { get; private set; }
public DateTime OpenTime { get; private set; }
public DateTime EndTime { get; private set; }
public DateTime CloseTime { get; private set; }
public DateTime BigChanceOpenTime { get; private set; }
public DoubleChanceData DoubleChanceReward { get; private set; }
public LotteryMissionData BigChanceMission { get; private set; }
public string BannerFileName { get; private set; }
public string BackGroundFileName { get; private set; }
public string AnnounceId { get; private set; }
public LotteryInfoData(JsonData responseData)
{
JsonData jsonData = responseData["data"];
CampaignId = jsonData["campaign_id"].ToInt();
InfoUrl = jsonData["info_url"].ToString();
StartTime = DateTime.Parse(jsonData["start_time"].ToString());
OpenTime = DateTime.Parse(jsonData["open_time"].ToString());
EndTime = DateTime.Parse(jsonData["end_time"].ToString());
CloseTime = DateTime.Parse(jsonData["close_time"].ToString());
LotteryRewardList = new List<LotteryRewardData>();
BannerFileName = jsonData["campaign_banner"].ToString();
BackGroundFileName = jsonData["campaign_bg_image"].ToString();
JsonData jsonData2 = jsonData["lottery_reward_list"];
for (int i = 0; i < jsonData2.Count; i++)
{
LotteryRewardData item = new LotteryRewardData(jsonData2[i]);
LotteryRewardList.Add(item);
}
if (jsonData.Keys.Contains("double_chance"))
{
JsonData data = jsonData["double_chance"];
DoubleChanceReward = new DoubleChanceData(data);
}
if (jsonData.TryGetValue("big_chance", out var value) && jsonData.TryGetValue("big_chance_reward", out var value2))
{
BigChanceMission = new LotteryMissionData(value, responseData["data_headers"]["servertime"].ToDouble());
BigChanceReward = new LotteryRewardData(value2);
BigChanceOpenTime = DateTime.Parse(value["open_time"].ToString());
}
if (jsonData.TryGetValue("append_lottery_reward_list", out var value3))
{
JsonData jsonData3 = jsonData["append_mission_info_list"];
Dictionary<int, LotteryMissionData> dictionary = new Dictionary<int, LotteryMissionData>();
LotteryMissionList = new List<LotteryMissionData>();
for (int j = 0; j < jsonData3.Count; j++)
{
LotteryMissionData lotteryMissionData = new LotteryMissionData(jsonData3[j], responseData["data_headers"]["servertime"].ToDouble());
LotteryMissionList.Add(lotteryMissionData);
dictionary.Add(lotteryMissionData.MissionId, lotteryMissionData);
}
MissionRewardList = new List<LotteryRewardData>();
for (int k = 0; k < value3.Count; k++)
{
LotteryRewardData lotteryRewardData = new LotteryRewardData(value3[k]);
MissionRewardList.Add(lotteryRewardData);
lotteryRewardData.MissionData = dictionary[lotteryRewardData.MissionId];
}
}
if (jsonData.TryGetValue("announce_id", out var value4))
{
AnnounceId = value4.ToString();
}
}
}
public class LotteryInfoTaskParam : BaseParam
{
public int campaign_id;
}
public LotteryInfoData Result { get; private set; }
public LotteryInfoTask()
{
base.type = ApiType.Type.LotteryInfo;
}
public void SetParameter(int campaign_id)
{
LotteryInfoTaskParam lotteryInfoTaskParam = new LotteryInfoTaskParam();
lotteryInfoTaskParam.campaign_id = campaign_id;
base.Params = lotteryInfoTaskParam;
}
protected override int Parse()
{
int num = base.Parse();
if (num != 1)
{
return num;
}
Result = new LotteryInfoData(base.ResponseData);
return num;
}
}

View File

@@ -0,0 +1,859 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Cute;
using UnityEngine;
using Wizard.Bingo;
namespace Wizard.Lottery;
public class LotteryPage : UIBase
{
private enum BoxType
{
NORMAL,
DOUBLE_CHANCE,
MISSION,
BIG_CHANCE
}
public struct LayoutData
{
public Vector3 BackGroundPosition { get; private set; }
public int BackGroundWidth { get; private set; }
public Vector3 GridPosition { get; private set; }
public Vector2 GridInterval { get; private set; }
public bool EnableCategoryLabel { get; private set; }
public Vector2 MissionBoxBackgroundInterval { get; private set; }
public Vector2 MisshonBoxBackgroundPosition { get; private set; }
public bool UseDefaultTreasureBox { get; private set; }
public bool UseDefaultTodayEffect { get; private set; }
public LayoutData(Vector3 backgroundPosition, int backGroundWidth, Vector3 gridPosition, Vector2 gridInterval, Vector2 missionBoxBackgroundInterval, Vector2 misshonBoxBackgroundPosition, bool enableCategoryLabel, bool useDefaultTreasureBox, bool useDefaultTodayEffect)
{
BackGroundPosition = backgroundPosition;
BackGroundWidth = backGroundWidth;
GridPosition = gridPosition;
GridInterval = gridInterval;
EnableCategoryLabel = enableCategoryLabel;
UseDefaultTreasureBox = useDefaultTreasureBox;
UseDefaultTodayEffect = useDefaultTodayEffect;
MissionBoxBackgroundInterval = missionBoxBackgroundInterval;
MisshonBoxBackgroundPosition = misshonBoxBackgroundPosition;
}
}
private readonly Vector3[] MISSION_TREASURE_BOX_POSITION = new Vector3[4]
{
new Vector3(-88f, 46f, 0f),
new Vector3(90f, 46f, 0f),
new Vector3(-88f, -73f, 0f),
new Vector3(90f, -73f, 0f)
};
private readonly Vector3[] MISSION_TREASURE_BOX_POSITION_WITH_BIG_CHANCE = new Vector3[3]
{
new Vector3(-160f, -14f, 0f),
new Vector3(0f, -14f, 0f),
new Vector3(160f, -14f, 0f)
};
private readonly Vector3[] MISSION_TREASURE_BOX_POSITION_6TH_ANNIVERSARY = new Vector3[10]
{
new Vector3(-276f, 54f, 0f),
new Vector3(-138f, 54f, 0f),
new Vector3(0f, 54f, 0f),
new Vector3(138f, 54f, 0f),
new Vector3(276f, 54f, 0f),
new Vector3(-276f, -72f, 0f),
new Vector3(-138f, -72f, 0f),
new Vector3(0f, -72f, 0f),
new Vector3(138f, -72f, 0f),
new Vector3(276f, -72f, 0f)
};
private readonly string[] MISSION_TREASURE_BOX_CATEGORY_TEXT = new string[4] { "Story_0052", "Mission_0079", "MyPage_0009", "MyPage_0011" };
private readonly string[] MISSION_BIGCHANCE_TREASURE_BOX_CATEGORY_TEXT = new string[3] { "Mission_0093", "Mission_0094", "Mission_0095" };
private readonly string[] MISSION_6TH_ANNIVERSARY_TEXT = new string[10] { "Mission_0099", "Mission_0100", "Mission_0101", "Mission_0102", "Mission_0103", "Mission_0104", "Mission_0105", "Mission_0106", "Mission_0107", "Mission_0108" };
private const int SIXTH_ANNIVERSARY_ID = 11;
private const int SEVENTH_ANNIVERSARY_ID = 13;
private const int END_OF_YEAR_CAMPAIGN_ID = 14;
private const int EIGHT_ANNIVERSARY_ID = 15;
public const string TEXTURE_NAME_RECEIVED_LOTTERY_BOX = "thumbnail_lottery";
public const string TEXTURE_NAME_BLANK = "thumbnail_blank";
private const string TEXTURE_NAME_W_CHANCE_TITLE = "lottery_w_chance";
private const string TEXTURE_NAME_BIG_CHANCE_TITLE = "campaign_title_03";
private const string TODAY_EFFECT_DEFAULT = "cmn_login_icon_3";
private const string TODAY_EFFECT_SMALL = "cmn_campaign_icon_1";
public const string TEXTURE_LOTTERY_TICKET = "box_lottery_01_close";
public const string TEXTURE_LOTTERY_TICKET2 = "box_lottery_02_close";
public const string SE_BOX_OPEN_LOTTERY_TICKET_01 = "se_sys_box_open_lottery_ticket_01";
private Dictionary<int, LayoutData> LAYOUT_SETTING = new Dictionary<int, LayoutData>
{
{
10,
new LayoutData(new Vector3(-184f, -50f, 0f), 912, new Vector3(0f, 0f, 0f), new Vector2(147f, 121f), new Vector2(349f, 254f), new Vector2(138f, -50f), enableCategoryLabel: false, useDefaultTreasureBox: true, useDefaultTodayEffect: true)
},
{
12,
new LayoutData(new Vector3(-184f, -50f, 0f), 912, new Vector3(0f, 0f, 0f), new Vector2(147f, 121f), new Vector2(349f, 254f), new Vector2(138f, -50f), enableCategoryLabel: false, useDefaultTreasureBox: false, useDefaultTodayEffect: true)
},
{
14,
new LayoutData(new Vector3(-177f, -50f, 0f), 1059, new Vector3(5f, -5f, 0f), new Vector2(145f, 118f), new Vector2(349f, 254f), new Vector2(138f, -50f), enableCategoryLabel: false, useDefaultTreasureBox: true, useDefaultTodayEffect: true)
},
{
0,
new LayoutData(new Vector3(0f, 0f, 0f), 623, new Vector3(0f, 0f, 0f), new Vector2(0f, 0f), new Vector2(912f, 285f), new Vector2(-180f, -55f), enableCategoryLabel: true, useDefaultTreasureBox: true, useDefaultTodayEffect: false)
}
};
private Dictionary<int, LayoutData> LAYOUT_SETTING_BIG_CHANCE = new Dictionary<int, LayoutData> {
{
10,
new LayoutData(new Vector3(-431f, -50f, 0f), 610, new Vector3(0f, -14f, 0f), new Vector2(110f, 118f), new Vector2(488f, 133f), new Vector2(130f, 10f), enableCategoryLabel: true, useDefaultTreasureBox: true, useDefaultTodayEffect: false)
} };
[SerializeField]
private UITexture _textureTopImage;
[SerializeField]
private UILabel _labelCampaignPeriod;
[SerializeField]
private UITexture _backGround;
[SerializeField]
private GameObject _originalTreasureBox;
[SerializeField]
private GameObject _originalTreasureBox2;
[SerializeField]
private UIGrid _gridTreasureBox;
[SerializeField]
private LotterySpecialRewardDialog _prefabSpecialRewardDialog;
[SerializeField]
private LotteryTreasureBox _doubleChanceTreasureBox;
[SerializeField]
private LotteryTreasureBox _bigChanceTreasureBox;
[SerializeField]
private UITexture _textureWChanceTitle;
[SerializeField]
private UISprite _treasureBoxBackGround;
[SerializeField]
private GameObject _missionListRoot;
[SerializeField]
private GameObject _missionListParent;
[SerializeField]
private GameObject _missionListTreasureBoxOriginal;
[SerializeField]
private UIButton _missionFactorButton;
[SerializeField]
private UISprite _missionBoxBackGround;
[SerializeField]
private GameObject _missionDialogPrefab;
[SerializeField]
private GameObject _rewardSiteButton;
[SerializeField]
private GameObject _categoryLabel;
[SerializeField]
private GameObject _itemListRoot;
[SerializeField]
private GameObject _clickProtectCollider;
private List<string> _loadedResourceList = new List<string>();
private Dictionary<int, int> GRID_PER_LINE = new Dictionary<int, int>
{
{ 8, 4 },
{ 10, 5 },
{ 12, 6 },
{ 14, 7 },
{ 0, 0 }
};
private GameObject _boxOpenEffectObj;
private GameObject _treasureEffectObj;
private string _infoSiteUrl = string.Empty;
private GameObject _effectCurrentBox;
private bool _isPlayBoxOpenEffect;
private static int _lotteryNo;
private bool _isBigChance;
private DateTime _bigChanceOpenTime;
private readonly bool IS_ONE_MILLION_CAMPAIGN;
public static void ChangeSceneLotteryPage(int no)
{
_lotteryNo = no;
UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.LotteryPage);
}
private static bool Is6thAnniversary()
{
return _lotteryNo == 11;
}
private static bool Is7thAnniversary()
{
return _lotteryNo == 13;
}
private static bool Is8thAnniversary()
{
return _lotteryNo == 15;
}
public override void onFirstStart()
{
base.IsShowFooterMenu = true;
base.onFirstStart();
}
public void OnClickInfoSiteBtn()
{
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
UIManager.ShowDialogUrl(Data.SystemText.Get("Mission_0049"), _infoSiteUrl);
}
protected override void onOpen()
{
base.onOpen();
_clickProtectCollider.SetActive(value: false);
string titleMsg = Data.SystemText.Get("Mission_0048");
UIManager.GetInstance().CreateTopBar(base.gameObject, titleMsg, UIManager.ViewScene.MyPage).gameObject.layer = LayerMask.NameToLayer("MyPage");
InitFooter();
LotteryInfoTask task = new LotteryInfoTask();
task.SetParameter(_lotteryNo);
StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
{
Init(task.Result);
}));
}
protected override void onClose()
{
base.onClose();
UnloadResources();
UIManager.GetInstance()._Footer.CancelOverwriteLabelColors();
}
private void Init(LotteryInfoTask.LotteryInfoData lotteryData)
{
_isBigChance = lotteryData.BigChanceMission != null && lotteryData.BigChanceReward != null;
_bigChanceOpenTime = lotteryData.BigChanceOpenTime;
string text = ConvertTime.ToLocal(lotteryData.StartTime, lotteryData.EndTime);
string text2 = ConvertTime.ToLocal(lotteryData.CloseTime);
if (Is6thAnniversary() || Is7thAnniversary() || Is8thAnniversary() || _lotteryNo == 14)
{
string text3 = ConvertTime.ToLocal(lotteryData.EndTime);
string text4 = ConvertTime.ToLocal(lotteryData.OpenTime);
string text5 = ConvertTime.ToLocal(lotteryData.CloseTime);
_labelCampaignPeriod.text = Data.SystemText.Get("Mission_0097", text3, text4, text5);
}
else
{
_labelCampaignPeriod.text = Data.SystemText.Get("Mission_0057", text, text2);
}
if (lotteryData.MissionRewardList != null && lotteryData.MissionRewardList.Count > 0)
{
_missionFactorButton.onClick.Add(new EventDelegate(delegate
{
OnClickMissionFactorButton(lotteryData);
}));
}
else
{
_missionFactorButton.gameObject.SetActive(value: false);
Vector3 localPosition = _rewardSiteButton.transform.localPosition;
localPosition.y = 0f;
_rewardSiteButton.transform.localPosition = localPosition;
}
_infoSiteUrl = lotteryData.InfoUrl;
_gridTreasureBox.maxPerLine = GRID_PER_LINE[lotteryData.LotteryRewardList.Count];
bool useDefaultTreasureBox = true;
Dictionary<int, LayoutData> dictionary = LAYOUT_SETTING;
if (_isBigChance)
{
dictionary = LAYOUT_SETTING_BIG_CHANCE;
}
if (dictionary.TryGetValue(lotteryData.LotteryRewardList.Count, out var value))
{
_treasureBoxBackGround.width = value.BackGroundWidth;
_treasureBoxBackGround.transform.localPosition = value.BackGroundPosition;
_gridTreasureBox.transform.localPosition = value.GridPosition;
_gridTreasureBox.cellWidth = value.GridInterval.x;
_gridTreasureBox.cellHeight = value.GridInterval.y;
_categoryLabel.SetActive(value.EnableCategoryLabel);
useDefaultTreasureBox = value.UseDefaultTreasureBox;
_missionBoxBackGround.width = (int)value.MissionBoxBackgroundInterval.x;
_missionBoxBackGround.height = (int)value.MissionBoxBackgroundInterval.y;
_missionBoxBackGround.transform.localPosition = value.MisshonBoxBackgroundPosition;
}
StartCoroutine(LoadResources(lotteryData, delegate
{
CreateTreasureBoxGrid(lotteryData.LotteryRewardList, useDefaultTreasureBox);
if (lotteryData.DoubleChanceReward != null)
{
CreateDoubleChanceTreasureBox(lotteryData.DoubleChanceReward);
string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath("lottery_w_chance", ResourcesManager.AssetLoadPathType.Lottery, isfetch: true);
_textureWChanceTitle.mainTexture = Toolbox.ResourcesManager.LoadObject(assetTypePath) as Texture;
}
else
{
_doubleChanceTreasureBox.gameObject.SetActive(value: false);
}
if (_isBigChance)
{
CreateBigChanceTreasureBox(lotteryData.BigChanceMission, lotteryData.BigChanceReward);
}
else
{
_bigChanceTreasureBox.gameObject.SetActive(value: false);
}
string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(lotteryData.BannerFileName, ResourcesManager.AssetLoadPathType.Lottery, isfetch: true);
_textureTopImage.mainTexture = Toolbox.ResourcesManager.LoadObject(assetTypePath2) as Texture;
string assetTypePath3 = Toolbox.ResourcesManager.GetAssetTypePath(lotteryData.BackGroundFileName, ResourcesManager.AssetLoadPathType.Background, isfetch: true);
_backGround.mainTexture = Toolbox.ResourcesManager.LoadObject(assetTypePath3) as Texture;
InitializeMissionList(lotteryData);
UIManager.GetInstance().OnReadyViewScene(isFadein: true);
}));
AddSeCueSheet();
UIButton component = _rewardSiteButton.GetComponent<UIButton>();
component.onClick.Clear();
component.onClick.Add(new EventDelegate(delegate
{
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
OpenDetail(lotteryData);
}));
}
private void InitializeMissionList(LotteryInfoTask.LotteryInfoData lotteryData)
{
if (lotteryData.MissionRewardList == null || lotteryData.MissionRewardList.Count == 0)
{
_missionListRoot.SetActive(value: false);
return;
}
for (int i = 0; i < lotteryData.MissionRewardList.Count; i++)
{
LotteryRewardData data = lotteryData.MissionRewardList[i];
string categoryText = (_isBigChance ? Data.SystemText.Get(MISSION_BIGCHANCE_TREASURE_BOX_CATEGORY_TEXT[i]) : (Is6thAnniversary() ? Data.SystemText.Get(MISSION_6TH_ANNIVERSARY_TEXT[i]) : Data.SystemText.Get(MISSION_TREASURE_BOX_CATEGORY_TEXT[i])));
GameObject gameObject = NGUITools.AddChild(_missionListParent.gameObject, _missionListTreasureBoxOriginal);
gameObject.transform.localPosition = (_isBigChance ? MISSION_TREASURE_BOX_POSITION_WITH_BIG_CHANCE[i] : (Is6thAnniversary() ? MISSION_TREASURE_BOX_POSITION_6TH_ANNIVERSARY[i] : MISSION_TREASURE_BOX_POSITION[i]));
LotteryMissionTreasureBox box = gameObject.GetComponent<LotteryMissionTreasureBox>();
box.Initialize(data, categoryText, delegate
{
OnClickTreasureBox(box, BoxType.MISSION);
});
if (Is6thAnniversary())
{
box.SetCategoryLabelLineWitdh(95);
}
}
_missionListTreasureBoxOriginal.SetActive(value: false);
}
private IEnumerator LoadResources(LotteryInfoTask.LotteryInfoData lotteryInfoData, Action callBack)
{
ResourcesManager resMgr = Toolbox.ResourcesManager;
List<string> assetList = new List<string>();
for (int i = 0; i < lotteryInfoData.LotteryRewardList.Count; i++)
{
if (lotteryInfoData.LotteryRewardList[i].NormalGotRewardList.Count > 0)
{
LotteryRewardData.NormalGotRewardData normalGotRewardData = lotteryInfoData.LotteryRewardList[i].NormalGotRewardList[0];
string assetTypePath = resMgr.GetAssetTypePath(normalGotRewardData.TextureName, ResourcesManager.AssetLoadPathType.Item);
if (!assetList.Contains(assetTypePath) && !_loadedResourceList.Contains(assetTypePath))
{
assetList.Add(assetTypePath);
}
}
}
if (lotteryInfoData.DoubleChanceReward != null)
{
List<LotteryRewardData.NormalGotRewardData> normalGotRewardList = lotteryInfoData.DoubleChanceReward.RewardData.NormalGotRewardList;
if (normalGotRewardList.Count > 0)
{
string assetTypePath2 = resMgr.GetAssetTypePath(normalGotRewardList[0].TextureName, ResourcesManager.AssetLoadPathType.Item);
if (!assetList.Contains(assetTypePath2) && !_loadedResourceList.Contains(assetTypePath2))
{
assetList.Add(assetTypePath2);
}
}
assetList.Add(resMgr.GetAssetTypePath("lottery_w_chance", ResourcesManager.AssetLoadPathType.Lottery));
}
if (lotteryInfoData.BigChanceReward != null)
{
List<LotteryRewardData.NormalGotRewardData> normalGotRewardList2 = lotteryInfoData.BigChanceReward.NormalGotRewardList;
if (normalGotRewardList2.Count > 0)
{
string assetTypePath3 = resMgr.GetAssetTypePath(normalGotRewardList2[0].TextureName, ResourcesManager.AssetLoadPathType.Item);
if (!assetList.Contains(assetTypePath3) && !_loadedResourceList.Contains(assetTypePath3))
{
assetList.Add(assetTypePath3);
}
}
assetList.Add(resMgr.GetAssetTypePath("campaign_title_03", ResourcesManager.AssetLoadPathType.Arena));
}
if (lotteryInfoData.LotteryMissionList != null)
{
foreach (LotteryMissionData lotteryMission in lotteryInfoData.LotteryMissionList)
{
string userGoodsImageName = UserGoods.GetUserGoodsImageName(lotteryMission.UserGoodsType, lotteryMission.ItemId);
string assetTypePath4 = resMgr.GetAssetTypePath(userGoodsImageName, ResourcesManager.AssetLoadPathType.Item);
assetList.Add(assetTypePath4);
}
}
for (int j = 0; j < lotteryInfoData.MissionRewardList.Count; j++)
{
if (lotteryInfoData.MissionRewardList[j].NormalGotRewardList.Count > 0)
{
LotteryRewardData.NormalGotRewardData normalGotRewardData2 = lotteryInfoData.MissionRewardList[j].NormalGotRewardList[0];
string assetTypePath5 = resMgr.GetAssetTypePath(normalGotRewardData2.TextureName, ResourcesManager.AssetLoadPathType.Item);
if (!assetList.Contains(assetTypePath5) && !_loadedResourceList.Contains(assetTypePath5))
{
assetList.Add(assetTypePath5);
}
}
}
assetList.Add(resMgr.GetAssetTypePath(lotteryInfoData.BannerFileName, ResourcesManager.AssetLoadPathType.Lottery));
assetList.Add(resMgr.GetAssetTypePath("thumbnail_lottery", ResourcesManager.AssetLoadPathType.Lottery));
assetList.Add(resMgr.GetAssetTypePath("thumbnail_blank", ResourcesManager.AssetLoadPathType.Lottery));
assetList.Add(resMgr.GetAssetTypePath(lotteryInfoData.BackGroundFileName, ResourcesManager.AssetLoadPathType.Background));
assetList.Add(resMgr.GetAssetTypePath("box_lottery_01_close", ResourcesManager.AssetLoadPathType.Lottery));
assetList.Add(resMgr.GetAssetTypePath("box_lottery_02_close", ResourcesManager.AssetLoadPathType.Lottery));
string effectPath = "cmn_login_icon_3";
Dictionary<int, LayoutData> dictionary = LAYOUT_SETTING;
if (_isBigChance)
{
dictionary = LAYOUT_SETTING_BIG_CHANCE;
}
if (dictionary.TryGetValue(lotteryInfoData.LotteryRewardList.Count, out var value) && !value.UseDefaultTodayEffect)
{
effectPath = "cmn_campaign_icon_1";
}
assetList.Add(resMgr.GetAssetTypePath(effectPath, ResourcesManager.AssetLoadPathType.Effect2D));
if (assetList.Count > 0)
{
yield return StartCoroutine(resMgr.LoadAssetGroupAsync(assetList, null));
_loadedResourceList.AddRange(assetList);
}
_effectCurrentBox = UnityEngine.Object.Instantiate(resMgr.LoadObject(resMgr.GetAssetTypePath(effectPath, ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true))) as GameObject;
_loadedResourceList.AddRange(GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(_effectCurrentBox, delegate
{
_effectCurrentBox.gameObject.SetActive(value: false);
callBack.Call();
}));
}
private void UnloadResources()
{
if (_loadedResourceList != null)
{
Toolbox.ResourcesManager.RemoveAssetGroup(_loadedResourceList);
_loadedResourceList.Clear();
}
}
private void CreateTreasureBoxGrid(List<LotteryRewardData> rewardDataList, bool useDefaultTeasureBox)
{
GameObject prefab = (useDefaultTeasureBox ? _originalTreasureBox : _originalTreasureBox2);
for (int i = 0; i < rewardDataList.Count; i++)
{
LotteryRewardData lotteryRewardData = rewardDataList[i];
LotteryTreasureBox treasureBox = NGUITools.AddChild(_gridTreasureBox.gameObject, prefab).GetComponent<LotteryTreasureBox>();
string infoText = Data.SystemText.Get("Mission_0056", (i + 1).ToString());
treasureBox.SetData(lotteryRewardData, infoText, delegate
{
OnClickTreasureBox(treasureBox, BoxType.NORMAL);
});
if (lotteryRewardData.IsCurrent)
{
PlayCurrentRewardEffect(treasureBox.gameObject);
}
}
if (rewardDataList.Count <= 0)
{
_itemListRoot.SetActive(value: false);
}
_originalTreasureBox.gameObject.SetActive(value: false);
_originalTreasureBox2.gameObject.SetActive(value: false);
_gridTreasureBox.repositionNow = true;
}
private void CreateDoubleChanceTreasureBox(DoubleChanceData doubleChanceData)
{
string infoText = Data.SystemText.Get("Mission_0058", doubleChanceData.RequireNum.ToString());
_doubleChanceTreasureBox.SetData(doubleChanceData.RewardData, infoText, delegate
{
OnClickTreasureBox(_doubleChanceTreasureBox, BoxType.DOUBLE_CHANCE);
});
}
private void CreateBigChanceTreasureBox(LotteryMissionData bigChanceMissionData, LotteryRewardData bigChanceReward)
{
string infoText = "";
if (bigChanceReward.state == LotteryRewardData.eLotteryRewardState.Unapplied)
{
infoText = Data.SystemText.Get("Mission_0088", bigChanceMissionData.MissionCurrent.ToString(), bigChanceMissionData.MissionMax.ToString());
}
else if (bigChanceReward.state == LotteryRewardData.eLotteryRewardState.Applied || bigChanceReward.state == LotteryRewardData.eLotteryRewardState.WaitResult)
{
string text = ConvertTime.ToLocal(_bigChanceOpenTime);
infoText = Data.SystemText.Get("Mission_0090", text);
}
_bigChanceTreasureBox.SetData(bigChanceReward, infoText, delegate
{
OnClickTreasureBox(_bigChanceTreasureBox, BoxType.BIG_CHANCE);
});
}
private void PlayCurrentRewardEffect(GameObject boxObj)
{
_effectCurrentBox.transform.parent = boxObj.transform;
_effectCurrentBox.transform.localPosition = Vector3.zero;
_effectCurrentBox.gameObject.SetActive(value: true);
}
private void OnClickTreasureBox(LotteryTreasureBox treasureBox, BoxType boxType)
{
if (_isPlayBoxOpenEffect)
{
return;
}
LotteryRewardData lotteryRewardData = treasureBox.LotteryRewardData;
if (lotteryRewardData.state == LotteryRewardData.eLotteryRewardState.NotReceived)
{
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_LOTTERY_BOX_TOUCH);
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
switch (boxType)
{
case BoxType.NORMAL:
case BoxType.MISSION:
{
LotteryReceiveTask task3 = new LotteryReceiveTask();
task3.SetParameter(lotteryRewardData.MissionId);
StartCoroutine(Toolbox.NetworkManager.Connect(task3, delegate
{
OnSuccessLotteryReceive(treasureBox, task3.Result);
}));
break;
}
case BoxType.DOUBLE_CHANCE:
{
LotteryReceiveDoubleChanceTask task2 = new LotteryReceiveDoubleChanceTask();
task2.SetParameter(_lotteryNo, lotteryRewardData.MissionId);
StartCoroutine(Toolbox.NetworkManager.Connect(task2, delegate
{
OnSuccessLotteryReceive(treasureBox, task2.Result);
}));
break;
}
case BoxType.BIG_CHANCE:
{
LotteryReceiveBigChanceTask task = new LotteryReceiveBigChanceTask();
task.SetParameter(_lotteryNo, lotteryRewardData.MissionId);
StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
{
OnSuccessLotteryReceive(treasureBox, task.Result);
}));
break;
}
}
}
else if (lotteryRewardData.state == LotteryRewardData.eLotteryRewardState.Received && lotteryRewardData.IsSpecial)
{
ShowReceivedDialog(lotteryRewardData);
}
}
private void OnSuccessLotteryReceive(LotteryTreasureBox treasureBox, LotteryRewardData receiveRewardData)
{
SetProtectColliderEnable(enableProtect: true);
List<string> assetList = new List<string>();
List<LotteryRewardData.NormalGotRewardData> normalGotRewardList = receiveRewardData.NormalGotRewardList;
for (int i = 0; i < normalGotRewardList.Count; i++)
{
string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(normalGotRewardList[i].TextureName, ResourcesManager.AssetLoadPathType.Item);
if (!assetList.Contains(assetTypePath) && !_loadedResourceList.Contains(assetTypePath))
{
assetList.Add(assetTypePath);
}
}
bool isBigChanceTreasureBox = treasureBox as LotteryBigChanceTreasureBox != null;
StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(assetList, delegate
{
_loadedResourceList.AddRange(assetList);
StartCoroutine(RunOpenBoxEffect(receiveRewardData.DialogMessage, isBigChanceTreasureBox, delegate
{
receiveRewardData.UpdateHaveUserGoodsByNormalRwardList();
treasureBox.UpdateData(receiveRewardData);
ShowReceivedDialog(receiveRewardData);
}));
}));
}
private void SetProtectColliderEnable(bool enableProtect)
{
_clickProtectCollider.SetActive(enableProtect);
GameMgr.GetIns().GetInputMgr().isBackKeyEnable = !enableProtect;
}
private void ShowReceivedDialog(LotteryRewardData lotteryRewardData)
{
SetProtectColliderEnable(enableProtect: false);
if (lotteryRewardData.IsSpecial && IS_ONE_MILLION_CAMPAIGN)
{
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
dialogBase.SetSize(DialogBase.Size.M);
dialogBase.SetTitleLabel(lotteryRewardData.DialogMessage);
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
dialogBase.OnClose = HideBoxEffect;
GameObject gameObject = UnityEngine.Object.Instantiate(_prefabSpecialRewardDialog.gameObject);
dialogBase.SetObj(gameObject);
gameObject.GetComponent<LotterySpecialRewardDialog>().Init(lotteryRewardData);
return;
}
DialogBase dialogBase2 = UIManager.GetInstance().CreateDialogClose();
dialogBase2.SetSize(DialogBase.Size.M);
dialogBase2.SetTitleLabel(lotteryRewardData.DialogMessage);
dialogBase2.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
dialogBase2.SetLayer("Loading");
dialogBase2.OnClose = HideBoxEffect;
GameObject gameObject2 = UnityEngine.Object.Instantiate(UIManager.GetInstance().GetRewardDialogPrefab().gameObject);
dialogBase2.SetObj(gameObject2);
RewardBase component = gameObject2.GetComponent<RewardBase>();
for (int i = 0; i < lotteryRewardData.NormalGotRewardList.Count; i++)
{
LotteryRewardData.NormalGotRewardData normalGotRewardData = lotteryRewardData.NormalGotRewardList[i];
NguiObjs nguiObjs = component.AddReward(normalGotRewardData.RewardType, normalGotRewardData.RewardId, normalGotRewardData.RewardGotNum);
if (lotteryRewardData.LotteryId > 0 && lotteryRewardData.Description.IsNotNullOrEmpty())
{
nguiObjs.labels[0].text = lotteryRewardData.Description;
}
}
component.EndCreate();
if (!string.IsNullOrEmpty(lotteryRewardData.PrizeMessage))
{
component.SetTitleLabel(isEnabled: true, lotteryRewardData.PrizeMessage);
}
else
{
component.SetTitleLabel(isEnabled: false, "");
}
}
private IEnumerator RunOpenBoxEffect(string message, bool isBigChanceTreasureBox, Action endAction)
{
_isPlayBoxOpenEffect = true;
UIManager.GetInstance().OpenNotTouch();
GameMgr.GetIns().GetInputMgr().isBackKeyEnable = false;
_boxOpenEffectObj = NGUITools.AddChild(base.gameObject, Resources.Load("UI/layoutParts/RankWinnerRewardResultPanel") as GameObject);
NguiObjs component = _boxOpenEffectObj.GetComponent<NguiObjs>();
UISprite bg = component.sprites[0];
UISprite window = component.sprites[1];
UISprite uISprite = component.sprites[2];
UIWidget box = uISprite;
if (isBigChanceTreasureBox)
{
uISprite.spriteName = "box_2pick_06_close";
UIManager.GetInstance().AttachAtlas(uISprite.gameObject);
}
else
{
uISprite.gameObject.SetActive(value: false);
UITexture uITexture = component.textures[0];
uITexture.gameObject.SetActive(value: true);
string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath("box_lottery_02_close", ResourcesManager.AssetLoadPathType.Lottery, isfetch: true);
uITexture.mainTexture = Toolbox.ResourcesManager.LoadObject(assetTypePath) as Texture;
box = uITexture;
}
UILabel label = component.labels[0];
label.text = message;
UIPanel panel = _boxOpenEffectObj.GetComponent<UIPanel>();
panel.alpha = 0f;
string loadEffectName = (isBigChanceTreasureBox ? "cmn_arena_treasure_7" : "cmn_arena_treasure_6");
List<string> loadList = new List<string> { Toolbox.ResourcesManager.GetAssetTypePath(loadEffectName, ResourcesManager.AssetLoadPathType.Effect2D) };
yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(loadList, null));
_loadedResourceList.AddRange(loadList);
_treasureEffectObj = UnityEngine.Object.Instantiate(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(loadEffectName, ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)) as GameObject);
_treasureEffectObj.transform.parent = _boxOpenEffectObj.transform;
_loadedResourceList.AddRange(GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(_treasureEffectObj, null));
_boxOpenEffectObj.SetLayer(LayerMask.NameToLayer("MyPage"), isSetChildren: true);
bg.alpha = 0f;
box.alpha = 0f;
label.alpha = 0f;
panel.alpha = 1f;
TweenAlpha.Begin(bg.gameObject, 0.5f, 0.65f);
TweenAlpha.Begin(label.gameObject, 0.5f, 1f);
TweenAlpha.Begin(box.gameObject, 0.5f, 1f);
label.transform.localPosition = new Vector3(100f, 0f, 0f);
window.transform.localScale = new Vector3(1f, 0.01f, 1f);
box.transform.localPosition = new Vector3(180f, 0f, 0f);
iTween.MoveTo(label.gameObject, iTween.Hash("x", 20f, "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
iTween.ScaleTo(window.gameObject, iTween.Hash("y", 1f, "time", 0.5f, "easetype", iTween.EaseType.easeInOutExpo));
iTween.MoveTo(box.gameObject, iTween.Hash("y", 20f, "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
yield return new WaitForSeconds(0.8f);
TweenAlpha.Begin(label.gameObject, 0.5f, 0f);
iTween.MoveTo(box.gameObject, iTween.Hash("x", 0f, "time", 0.7f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo));
GameMgr.GetIns().GetSoundMgr().PlaySeByStr("se_sys_box_open_lottery_ticket_01", "se_sys_box_open_lottery_ticket_01", 0f, 0L);
yield return new WaitForSeconds(1f);
_treasureEffectObj.transform.localPosition = box.transform.localPosition;
_treasureEffectObj.transform.localScale = Vector3.one * 320f * 1.75f;
_treasureEffectObj.SetActive(value: true);
box.gameObject.SetActive(value: false);
yield return new WaitForSeconds(1.2f);
endAction.Call();
UIManager.GetInstance().offNotTouch();
GameMgr.GetIns().GetInputMgr().isBackKeyEnable = true;
}
private void HideBoxEffect()
{
if (_isPlayBoxOpenEffect)
{
StartCoroutine(RunHideBoxEffect());
}
}
private IEnumerator RunHideBoxEffect()
{
NguiObjs component = _boxOpenEffectObj.GetComponent<NguiObjs>();
UISprite uISprite = component.sprites[0];
UISprite obj = component.sprites[1];
TweenAlpha.Begin(uISprite.gameObject, 0.3f, 0f);
TweenAlpha.Begin(obj.gameObject, 0.3f, 0f);
_treasureEffectObj.SetActive(value: false);
yield return new WaitForSeconds(0.3f);
_boxOpenEffectObj.SetActive(value: false);
UnityEngine.Object.Destroy(_boxOpenEffectObj);
_isPlayBoxOpenEffect = false;
}
private void OnClickMissionFactorButton(LotteryInfoTask.LotteryInfoData lotteryData)
{
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
LotteryMissionDialog.Create(_missionDialogPrefab, lotteryData);
}
private void AddSeCueSheet()
{
Toolbox.AudioManager.AddCueSheet("se_sys_box_open_lottery_ticket_01", "se_sys_box_open_lottery_ticket_01.acb", "s/");
}
private void InitFooter()
{
UIManager.GetInstance()._Footer.UpdateCurrentIndex(0);
}
private void InitSpriteAtlasOverwriter()
{
UIAtlas component = Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath("dummy", ResourcesManager.AssetLoadPathType.QuestAtlas, isfetch: true)).GetComponent<UIAtlas>();
UISpriteAtlasOverwriter.TargetObject[] targetObjects = new UISpriteAtlasOverwriter.TargetObject[2]
{
new UISpriteAtlasOverwriter.TargetObject(base.gameObject, includeChildren: true),
new UISpriteAtlasOverwriter.TargetObject(UIManager.GetInstance()._Footer.gameObject, includeChildren: true)
};
base.gameObject.AddMissingComponent<UISpriteAtlasOverwriter>().Init(component, targetObjects);
}
private void AddAtlasOverrider(DialogBase dialog)
{
UIAtlas component = Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath("dummy", ResourcesManager.AssetLoadPathType.QuestAtlas, isfetch: true)).GetComponent<UIAtlas>();
UISpriteAtlasOverwriter.TargetObject[] targetObjects = new UISpriteAtlasOverwriter.TargetObject[1]
{
new UISpriteAtlasOverwriter.TargetObject(dialog.gameObject, includeChildren: true)
};
dialog.gameObject.AddMissingComponent<UISpriteAtlasOverwriter>().Init(component, targetObjects);
}
private void OpenDetail(LotteryInfoTask.LotteryInfoData lotteryData)
{
if (!string.IsNullOrEmpty(lotteryData.AnnounceId))
{
UIManager.GetInstance().WebViewHelper.OpenAnnounceWebView(lotteryData.AnnounceId, delegate(DialogBase dialog)
{
SetExceptionDialog(dialog);
});
return;
}
if (!string.IsNullOrEmpty(lotteryData.InfoUrl))
{
UIManager.ShowDialogUrl(Data.SystemText.Get("Mission_0049"), lotteryData.InfoUrl);
return;
}
SystemText systemText = Data.SystemText;
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
dialogBase.SetSize(DialogBase.Size.M);
dialogBase.SetTitleLabel(systemText.Get("Bingo_0007"));
dialogBase.SetText(systemText.Get("Quest_0034"));
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
SetExceptionDialog(dialogBase);
}
private void SetExceptionDialog(DialogBase dialog)
{
List<UISpriteAtlasOverwriter.TargetObject> exceptionObjects = new List<UISpriteAtlasOverwriter.TargetObject>
{
new UISpriteAtlasOverwriter.TargetObject(dialog.gameObject, includeChildren: true)
};
UISpriteAtlasOverwriter component = base.gameObject.GetComponent<UISpriteAtlasOverwriter>();
if (component != null)
{
component.AddExceptionObjects(exceptionObjects);
}
}
public void LateUpdate()
{
BingoPage.FixDialogRibbon();
}
}

View File

@@ -0,0 +1,125 @@
using System.Collections.Generic;
using LitJson;
namespace Wizard.Lottery;
public class LotteryRewardData
{
public class NormalGotRewardData
{
private string _textureName = string.Empty;
public UserGoods.Type RewardType { get; private set; }
public long RewardId { get; private set; }
public int RewardGotNum { get; private set; }
public string TextureName
{
get
{
if (_textureName == string.Empty)
{
_textureName = UserGoods.GetUserGoodsImageName(RewardType, RewardId);
}
return _textureName;
}
}
public NormalGotRewardData(UserGoods.Type reward_type, long reward_id, int reward_got_num)
{
RewardType = reward_type;
RewardId = reward_id;
RewardGotNum = reward_got_num;
}
}
public enum eLotteryRewardState
{
None,
Unapplied,
Applied,
WaitResult,
NotReceived,
Received,
NotAchieved
}
public eLotteryRewardState state;
private JsonData NormalRewardList;
public int MissionId { get; private set; }
public int GradeId { get; private set; }
public bool IsCurrent { get; private set; }
public int LotteryId { get; private set; }
public string LotteryUrl { get; private set; }
public string DialogMessage { get; private set; }
public string Description { get; private set; }
public string PrizeMessage { get; private set; }
public List<NormalGotRewardData> NormalGotRewardList { get; private set; }
public LotteryMissionData MissionData { get; set; }
public bool IsSpecial
{
get
{
if (LotteryId <= 0)
{
return false;
}
return true;
}
}
public LotteryRewardData(JsonData lotteryRewardData)
{
MissionId = lotteryRewardData["mission_id"].ToInt();
state = (eLotteryRewardState)lotteryRewardData["status"].ToInt();
GradeId = lotteryRewardData["grade_id"].ToInt();
IsCurrent = lotteryRewardData["is_current"].ToInt() == 1;
LotteryId = lotteryRewardData["lottery_id"].ToInt();
LotteryUrl = lotteryRewardData["lottery_url"].ToString();
DialogMessage = lotteryRewardData["dialog_message"].ToString();
NormalGotRewardList = ParseGotRewardList(lotteryRewardData["got_reward_list"]);
PrizeMessage = lotteryRewardData.GetValueOrDefault("prize_message", string.Empty);
if (lotteryRewardData.TryGetValue("reward_list", out var _))
{
NormalRewardList = lotteryRewardData["reward_list"];
}
Description = lotteryRewardData["description_message"].ToString().Replace("\\n", "\n");
}
public void UpdateHaveUserGoodsByNormalRwardList()
{
if (NormalRewardList != null)
{
PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(NormalRewardList);
NormalRewardList = null;
}
}
private List<NormalGotRewardData> ParseGotRewardList(JsonData data)
{
List<NormalGotRewardData> list = new List<NormalGotRewardData>();
for (int i = 0; i < data.Count; i++)
{
JsonData jsonData = data[i];
UserGoods.Type reward_type = (UserGoods.Type)jsonData["reward_type"].ToInt();
long reward_id = jsonData["reward_id"].ToLong();
int reward_got_num = jsonData["reward_got_num"].ToInt();
list.Add(new NormalGotRewardData(reward_type, reward_id, reward_got_num));
}
return list;
}
}

View File

@@ -0,0 +1,26 @@
using UnityEngine;
namespace Wizard.Lottery;
public class LotterySpecialRewardDialog : MonoBehaviour
{
[SerializeField]
private UILabel _labelDescription;
private LotteryRewardData _lotteryRewardData;
public void Init(LotteryRewardData lotteryRewardData)
{
_lotteryRewardData = lotteryRewardData;
_labelDescription.text = _lotteryRewardData.Description;
}
public void OnClickSpecialRewardSiteBtn()
{
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
if (_lotteryRewardData.IsSpecial)
{
UIManager.GetInstance().WebViewHelper.OpenUrl(_lotteryRewardData.LotteryUrl);
}
}
}

View File

@@ -0,0 +1,232 @@
using System;
using Cute;
using UnityEngine;
namespace Wizard.Lottery;
public class LotteryTreasureBox : MonoBehaviour
{
private static readonly Color COLOR_NON_ACTIVE_REWARD_IMAGE = new Color32(65, 65, 65, byte.MaxValue);
private static readonly Color COLOR_NON_ACTIVE_NUM_TEXT = new Color32(100, 100, 100, byte.MaxValue);
private static readonly Color COLOR_TICKET_WAIT = new Color32(90, 90, 90, byte.MaxValue);
[SerializeField]
protected UILabel _labelInfoText;
[SerializeField]
protected UILabel _labelStatus;
[SerializeField]
protected UILabel _labelRewardNum;
[SerializeField]
protected UITexture _textureRewardImage;
[SerializeField]
protected UITexture _textureRewardImageFg;
[SerializeField]
protected UISprite _spriteTreasureImage;
[SerializeField]
protected UILabel _labelTreasureTouch;
[SerializeField]
protected GameObject _touchObject;
protected LotteryRewardData _lotteryRewardData;
public LotteryRewardData LotteryRewardData => _lotteryRewardData;
public void SetData(LotteryRewardData rewardData, string infoText, Action onClickEvent = null)
{
_labelInfoText.text = infoText;
UIEventListener.Get(base.gameObject).onClick = null;
UIEventListener.Get(base.gameObject).onClick = delegate
{
onClickEvent.Call();
};
UpdateData(rewardData);
}
public void UpdateData(LotteryRewardData rewardData)
{
_lotteryRewardData = rewardData;
UpdateInfoLabel();
UpdateStatusText();
UpdateRewardImage();
UpdateNonActiveColor();
}
protected virtual void UpdateInfoLabel()
{
if (_lotteryRewardData.state == LotteryRewardData.eLotteryRewardState.NotReceived)
{
_labelInfoText.gameObject.SetActive(value: false);
}
else
{
_labelInfoText.gameObject.SetActive(value: true);
}
}
protected virtual void UpdateStatusText()
{
switch (_lotteryRewardData.state)
{
case LotteryRewardData.eLotteryRewardState.Unapplied:
_labelStatus.text = Data.SystemText.Get("Mission_0051");
break;
case LotteryRewardData.eLotteryRewardState.Applied:
_labelStatus.text = Data.SystemText.Get("Mission_0053");
break;
case LotteryRewardData.eLotteryRewardState.WaitResult:
_labelStatus.text = Data.SystemText.Get("Mission_0052");
break;
case LotteryRewardData.eLotteryRewardState.NotReceived:
_labelStatus.text = string.Empty;
break;
case LotteryRewardData.eLotteryRewardState.Received:
if (_lotteryRewardData.IsSpecial)
{
_labelStatus.text = string.Empty;
}
else
{
_labelStatus.text = Data.SystemText.Get("Mission_0054");
}
break;
default:
_labelStatus.text = string.Empty;
break;
}
}
protected virtual void UpdateRewardImage()
{
bool flag = LotteryRewardData.state == LotteryRewardData.eLotteryRewardState.WaitResult || LotteryRewardData.state == LotteryRewardData.eLotteryRewardState.Applied;
if (_textureRewardImageFg != null)
{
_textureRewardImageFg.gameObject.SetActive(flag);
}
if (_touchObject != null)
{
_touchObject.SetActive(LotteryRewardData.state == LotteryRewardData.eLotteryRewardState.NotReceived);
}
string textureRewardImage = string.Empty;
ChangeSpriteSizeForTicket(isExpandSize: false);
if (_lotteryRewardData.state == LotteryRewardData.eLotteryRewardState.NotReceived)
{
_labelRewardNum.gameObject.SetActive(value: false);
string path = "box_lottery_01_close";
textureRewardImage = Toolbox.ResourcesManager.GetAssetTypePath(path, ResourcesManager.AssetLoadPathType.Lottery, isfetch: true);
SetTextureRewardImage(textureRewardImage);
ChangeSpriteSizeForTicket(isExpandSize: true);
_labelTreasureTouch.text = GetTouchText();
}
else if (_lotteryRewardData.state == LotteryRewardData.eLotteryRewardState.Received)
{
if (_lotteryRewardData.IsSpecial)
{
string path2 = "thumbnail_lottery";
textureRewardImage = Toolbox.ResourcesManager.GetAssetTypePath(path2, ResourcesManager.AssetLoadPathType.Lottery, isfetch: true);
_labelRewardNum.gameObject.SetActive(value: false);
}
else if (_lotteryRewardData.NormalGotRewardList.Count > 0)
{
string textureName = _lotteryRewardData.NormalGotRewardList[0].TextureName;
textureRewardImage = Toolbox.ResourcesManager.GetAssetTypePath(textureName, ResourcesManager.AssetLoadPathType.Item, isfetch: true);
_labelRewardNum.gameObject.SetActive(value: true);
_labelRewardNum.text = _lotteryRewardData.NormalGotRewardList[0].RewardGotNum.ToString();
}
SetTextureRewardImage(textureRewardImage);
}
else if (_textureRewardImageFg != null && flag)
{
_labelRewardNum.gameObject.SetActive(value: false);
string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath("thumbnail_blank", ResourcesManager.AssetLoadPathType.Lottery, isfetch: true);
SetTextureRewardImage(assetTypePath);
string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath("box_lottery_01_close", ResourcesManager.AssetLoadPathType.Lottery, isfetch: true);
SetTextureRewardImageFg(assetTypePath2);
}
else
{
string path3 = "thumbnail_blank";
textureRewardImage = Toolbox.ResourcesManager.GetAssetTypePath(path3, ResourcesManager.AssetLoadPathType.Lottery, isfetch: true);
_labelRewardNum.gameObject.SetActive(value: false);
SetTextureRewardImage(textureRewardImage);
}
}
protected string GetTouchText()
{
_ = string.Empty;
return Data.SystemText.Get("Common_0146");
}
private void ChangeSpriteSizeForTicket(bool isExpandSize)
{
_textureRewardImage.width = (isExpandSize ? 115 : 87);
_textureRewardImage.height = (isExpandSize ? 115 : 87);
}
protected void SetTextureRewardImage(string imagePath)
{
_textureRewardImage.gameObject.SetActive(value: true);
_spriteTreasureImage.gameObject.SetActive(value: false);
_textureRewardImage.mainTexture = Toolbox.ResourcesManager.LoadObject(imagePath) as Texture;
}
private void SetTextureRewardImageFg(string imagePath)
{
_textureRewardImageFg.gameObject.SetActive(value: true);
_textureRewardImageFg.mainTexture = Toolbox.ResourcesManager.LoadObject(imagePath) as Texture;
_textureRewardImageFg.color = COLOR_TICKET_WAIT;
}
protected virtual void UpdateNonActiveColor()
{
switch (_lotteryRewardData.state)
{
case LotteryRewardData.eLotteryRewardState.Unapplied:
SetNonActiveColor(isNonActive: true);
break;
case LotteryRewardData.eLotteryRewardState.Received:
if (_lotteryRewardData.IsSpecial)
{
SetNonActiveColor(isNonActive: false);
}
else
{
SetNonActiveColor(isNonActive: true);
}
break;
case LotteryRewardData.eLotteryRewardState.Applied:
case LotteryRewardData.eLotteryRewardState.WaitResult:
case LotteryRewardData.eLotteryRewardState.NotReceived:
SetNonActiveColor(isNonActive: false);
break;
default:
_labelStatus.text = string.Empty;
break;
}
}
protected virtual void SetNonActiveColor(bool isNonActive)
{
if (isNonActive)
{
_textureRewardImage.color = COLOR_NON_ACTIVE_REWARD_IMAGE;
_labelRewardNum.color = COLOR_NON_ACTIVE_NUM_TEXT;
_labelStatus.color = LabelDefine.TEXT_COLOR_CREAM;
}
else
{
_textureRewardImage.color = Color.white;
_labelRewardNum.color = LabelDefine.TEXT_COLOR_NORMAL;
_labelStatus.color = LabelDefine.TEXT_COLOR_NORMAL;
}
}
}