Пример #1
0
    /// <summary>
    /// 展示界面
    /// </summary>
    public void ShowHospitalView()
    {
        GetHospitalEventList();
        if (listEvent == null || listEvent.Count <= 0)
        {
            TipProxy.ShowTip(Localization.Get("UI_Function_Warn"));
            return;
        }
        int         idx = UnityEngine.Random.Range(0, listEvent.Count);
        Tab_Hospial tab = listEvent[idx];
        //显示通知
        string msg = string.Format(tab.Introduce, tab.Cost);

        TextWrop.Instance.ShowContent(mNoticeText, msg);
        //加载确定方法
        AddButtonEvent(mConfirmObj, OnClickConfirm, tab);
    }
Пример #2
0
 /// <summary>
 /// 邮局方法 获取相关事件
 /// </summary>
 private void GetHospitalEventList()
 {
     listEvent.Clear();
     //判断玩家健康情况
     foreach (var item in hospitalDir.Values)
     {
         Tab_Hospial tab = item as Tab_Hospial;
         if (tab == null)
         {
             continue;
         }
         //判断玩家健康值在哪个区间
         if (PlayerData.Instance.Health <= tab.HealtheMax && PlayerData.Instance.Health > tab.HealtheMin)
         {
             listEvent.Add(tab);
         }
     }
 }
Пример #3
0
    private void OnClickConfirm(GameObject btn, object sender)
    {
        Tab_Hospial tab = sender as Tab_Hospial;

        if (tab == null)
        {
            return;
        }
        if (PlayerData.Instance.Cash >= tab.Cost)
        {
            PlayerData.Instance.Cash  -= tab.Cost;
            PlayerData.Instance.Health = 100;
        }
        else
        {
            TipProxy.ShowTip(Localization.Get("UI_Hospital_Warn"));
        }
        UIManager.Instance.Hide(View.HospitalView);
        DetailDataView.instance.UpdatePlayData();
    }