备份CatanBuilding瘦身独立工程
This commit is contained in:
45
Assets/Scripts/UI/Home/HomeRightPanel.cs
Normal file
45
Assets/Scripts/UI/Home/HomeRightPanel.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using asap.core;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UniRx;
|
||||
|
||||
public class HomeRightPanel : MonoBehaviour
|
||||
{
|
||||
protected CompositeDisposable disposables = new CompositeDisposable();
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
GContext.OnEvent<TargetEvent>()
|
||||
.Where(_ => (_.type == 8 && _.subType > 3)
|
||||
|| (_.type == 10 && _.subType == 1)
|
||||
|| (_.type == 4 && _.subType == 1)
|
||||
)
|
||||
.Subscribe(FishingEvent).AddTo(disposables);
|
||||
GContext.OnEvent<HideHomePanelEvent>().Subscribe(OnHideHomePanelEvent).AddTo(disposables);
|
||||
|
||||
}
|
||||
private void OnHideHomePanelEvent(HideHomePanelEvent e)
|
||||
{
|
||||
Destroy(this);
|
||||
}
|
||||
void FishingEvent(TargetEvent targetEvent)
|
||||
{
|
||||
if (targetEvent.type == 8)
|
||||
{
|
||||
transform.Find("btn_luckycards").gameObject.SetActive(true);
|
||||
}
|
||||
else if (targetEvent.type == 10 && targetEvent.subType == 1)
|
||||
{
|
||||
transform.Find("btn_challenge").gameObject.SetActive(true);
|
||||
}
|
||||
else if (targetEvent.type == 4 && targetEvent.subType == 1)
|
||||
{
|
||||
transform.Find("btn_sanddig").gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
void OnDestroy()
|
||||
{
|
||||
disposables?.Dispose();
|
||||
disposables = null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user