备份CatanBuilding瘦身独立工程
This commit is contained in:
86
Assets/Scripts/UI/SmallGame/EventGamePlayPanel.cs
Normal file
86
Assets/Scripts/UI/SmallGame/EventGamePlayPanel.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
using asap.core;
|
||||
using game;
|
||||
using Game;
|
||||
using GameCore;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
public class EventGamePlayPanel : MonoBehaviour
|
||||
{
|
||||
GameObject bomb;
|
||||
GameObject bank;
|
||||
GameObject hunting;
|
||||
int id;
|
||||
bool isReward;
|
||||
private void Awake()
|
||||
{
|
||||
bomb = transform.Find("root/bomb").gameObject;
|
||||
bank = transform.Find("root/bank").gameObject;
|
||||
hunting = transform.Find("root/hunting").gameObject;
|
||||
GContext.container.Resolve<GuideDataCenter>().InspectTriggerGuide("EventGamePlayPanel");
|
||||
}
|
||||
public void StartGame(int id, bool isReward = false)
|
||||
{
|
||||
//GContext.Publish(new VibrationData(HapticTypes.Warning));
|
||||
this.id = id;
|
||||
this.isReward = isReward;
|
||||
//bank.SetActive(id == 11);
|
||||
bomb.SetActive(id == 12);
|
||||
hunting.SetActive(id == 11);
|
||||
Transition();
|
||||
}
|
||||
|
||||
async void Transition()
|
||||
{
|
||||
await Task.Delay(1000);
|
||||
IsShowGuidance isShowGuidance = new IsShowGuidance();
|
||||
GContext.Publish(isShowGuidance);
|
||||
if (!isShowGuidance.isShow)
|
||||
{
|
||||
EnterSmallGame();
|
||||
}
|
||||
else
|
||||
{
|
||||
await isShowGuidance.tcs.Task;
|
||||
EnterSmallGame();
|
||||
}
|
||||
}
|
||||
void EnterSmallGame()
|
||||
{
|
||||
IStageData stageData = GContext.container.Resolve<IStageData>();
|
||||
stageData.Id = id;
|
||||
stageData.Type = StageType.SmallGame;
|
||||
stageData.IsRewardSettlement = isReward;
|
||||
if (id == 11)
|
||||
{
|
||||
GContext.Publish(new UnloadActToNextAct("ShooterFishAct"));
|
||||
}
|
||||
else
|
||||
{
|
||||
GContext.Publish(new UnloadActToNextAct("SmallGameAct"));
|
||||
}
|
||||
cfg.Tables _tables = GContext.container.Resolve<cfg.Tables>();
|
||||
if (GContext.container.Resolve<PlayerFishData>().GetAnglingCount() >= GContext.container.Resolve<MMTService>().FixedFish.Count
|
||||
|| GContext.container.Resolve<PlayerData>().lastMapId != _tables.TbMapData.DataList[0].ID)
|
||||
{
|
||||
if (!GContext.container.Resolve<FishingData>().IsNewItemFish() && isReward)
|
||||
{
|
||||
GContext.container.Resolve<PlayerFishData>().SetBotCount(0);
|
||||
}
|
||||
}
|
||||
GContext.Publish(new OnSoundStateEvent(0));
|
||||
//ConvertTools.SetFSBlur(false);
|
||||
DisableFishingBlur();
|
||||
}
|
||||
|
||||
private void DisableFishingBlur()
|
||||
{
|
||||
var stage = RootCtx.container.Resolve<IStageService>().GetStage("FishingStage");
|
||||
if(stage != null && stage.Id == "FishingStage")
|
||||
{
|
||||
var act = stage.CurrentAct as FishingAct;
|
||||
if(act != null)
|
||||
act.EnableFishingVolume(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user