164 lines
5.1 KiB
C#
164 lines
5.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using GCGame.Table;
|
|
|
|
public class CommonSportsPanel : MonoBehaviour {
|
|
|
|
public static CommonSportsPanel Instance;
|
|
private void Awake()
|
|
{
|
|
Instance = this;
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
Instance = null;
|
|
}
|
|
|
|
public Text _Desc;
|
|
public Text _Rule;
|
|
public Image _BGImage;
|
|
public List<Sprite> _BGImageList;
|
|
public UIContainerBase _RewItemContainer;
|
|
public GameObject _IntergalBtn;
|
|
private SportsPanel.SportsType _CurSelectType;
|
|
public void ShowPanel(SportsPanel.SportsType type)
|
|
{
|
|
_CurSelectType = type;
|
|
var tabId = (int)type;
|
|
var commonSportsTab = TableManager.GetCommonSportsSetByID(tabId, 0);
|
|
if (commonSportsTab == null)
|
|
return;
|
|
|
|
List<InteractionRewItem.InteractionRewItemData> rewList = new List<InteractionRewItem.InteractionRewItemData>();
|
|
var rewString = commonSportsTab.RewString.Split('|');
|
|
for (int index = 0; index < rewString.Length; index++)
|
|
{
|
|
rewList.Add(new InteractionRewItem.InteractionRewItemData(int.Parse(rewString[index]), 0));
|
|
}
|
|
|
|
_RewItemContainer.InitContentItem(rewList);
|
|
|
|
_Desc.text = commonSportsTab.SportsDesc;
|
|
_Rule.text = commonSportsTab.Rule.Replace("#r", "\n"); ;
|
|
_BGImage.overrideSprite = _BGImageList[tabId - 1];
|
|
|
|
ShowIntergalBtn();
|
|
}
|
|
|
|
void ShowIntergalBtn()
|
|
{
|
|
switch (_CurSelectType)
|
|
{
|
|
case SportsPanel.SportsType.Digong:
|
|
case SportsPanel.SportsType.Guild:
|
|
{
|
|
_IntergalBtn.SetActive(false);
|
|
}
|
|
break;
|
|
case SportsPanel.SportsType.Yanwu:
|
|
{
|
|
_IntergalBtn.SetActive(true);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
public void OnPartIn()
|
|
{
|
|
switch(_CurSelectType)
|
|
{
|
|
case SportsPanel.SportsType.Guild:
|
|
{
|
|
if (GameManager.gameManager.PlayerDataPool.IsHaveGuild() == false)
|
|
{
|
|
// 加入帮派提醒
|
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{6707}"));
|
|
return;
|
|
}
|
|
|
|
var activityBase = ActivityDataManager.Instance.GetActivityTabByServerType(ActivityDataManager.Activity_Type.ACTIVITY_TYPE_GUILD_UNION_MATCH);
|
|
string[] paramaters = activityBase.Parameter.Split('|');
|
|
int roleId = int.Parse(paramaters[0]);
|
|
float posX = float.Parse(paramaters[1]);
|
|
float posZ = float.Parse(paramaters[2]);
|
|
|
|
GameManager.gameManager.AutoSearch.BackGuild(GameManager.gameManager.PlayerDataPool.GuildInfo.GuildGuid,
|
|
int.Parse(paramaters[0]), float.Parse(paramaters[1]), float.Parse(paramaters[2]));
|
|
|
|
UIManager.CloseUI(UIInfo.SportsPanel);
|
|
}
|
|
break;
|
|
case SportsPanel.SportsType.Digong:
|
|
{
|
|
TreasureGold();
|
|
}
|
|
break;
|
|
case SportsPanel.SportsType.Yanwu:
|
|
{
|
|
MessageHelpLogic.ShowHelpMessage(35);
|
|
//UIManager.ShowUI(UIInfo.GuanningRegistRoot);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
public static void TreasureGold()
|
|
{
|
|
MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{39500}"), null, delegate ()
|
|
{
|
|
if (GameManager.gameManager.PlayerDataPool.Money.GetMoney_Coin() >= 10000)
|
|
{
|
|
CG_TREASURE_GOLD_OPTION send = (CG_TREASURE_GOLD_OPTION)PacketDistributed.CreatePacket(MessageID.PACKET_CG_TREASURE_GOLD_OPTION);
|
|
send.SetOptiontype(5);
|
|
send.SendPacket();
|
|
}
|
|
else
|
|
{
|
|
MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{39512}"), null, delegate ()
|
|
{
|
|
JudgeMoneyLogic.ShowSwitchMoneyPanel(MONEYTYPE.MONEYTYPE_COIN, true);
|
|
}, null);
|
|
}
|
|
|
|
}, null);
|
|
}
|
|
|
|
|
|
public void OnScoreShop()
|
|
{
|
|
switch (_CurSelectType)
|
|
{
|
|
case SportsPanel.SportsType.Yanwu:
|
|
{
|
|
YuanBaoShopLogic.OpenShopForJiFenItem(5, -1);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
public void OnRuleBtn()
|
|
{
|
|
switch (_CurSelectType)
|
|
{
|
|
case SportsPanel.SportsType.Guild:
|
|
{
|
|
MessageHelpLogic.ShowHelpMessage(34);
|
|
}
|
|
break;
|
|
case SportsPanel.SportsType.Digong:
|
|
{
|
|
MessageHelpLogic.ShowHelpMessage(59);
|
|
}
|
|
break;
|
|
case SportsPanel.SportsType.Yanwu:
|
|
{
|
|
MessageHelpLogic.ShowHelpMessage(35);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|