using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Games.LogicObj;
using GCGame.Table;
using Games.GlobeDefine;
using Module.Log;

public class TreasureSignUp : MonoBehaviour
{
    public Text Tip;

    private void OnEnable()
    {
        Tip.text = StrDictionary.GetClientDictionaryString("#{39511}");
    }

    public void TreasureGlodOK()
    {
        MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{39500}"), null, TreasureGlodPayOK, null);
    }

    public void TreasureEnter()
    {
        CG_TREASURE_GOLD_OPTION send = (CG_TREASURE_GOLD_OPTION)PacketDistributed.CreatePacket(MessageID.PACKET_CG_TREASURE_GOLD_OPTION);
        send.SetOptiontype(1);
        send.SendPacket();
    }

    public void TreasureGlodPayOK()
    {
        if (GameManager.gameManager.PlayerDataPool.Money.GetMoney_Coin() >= 1000)
        {
            CG_TREASURE_GOLD_OPTION send = (CG_TREASURE_GOLD_OPTION)PacketDistributed.CreatePacket(MessageID.PACKET_CG_TREASURE_GOLD_OPTION);
            send.SetOptiontype(0);
            send.SendPacket();
        }
        else
        {
            MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{39512}"), null, delegate ()
            {
                JudgeMoneyLogic.ShowSwitchMoneyPanel(MONEYTYPE.MONEYTYPE_COIN, true);
            }, null);
        }
    }

    public void Close()
    {
        UIManager.CloseUI(UIInfo.TreasureSignUp);
    }
}