Esempio n. 1
0
        /// <summary>
        /// 治疗侠客
        /// </summary>
        /// <param name="id">Identifier.</param>
        public void CureRole(int id)
        {
            db = OpenDb();
            SqliteDataReader sqReader = db.ExecuteQuery("select RoleData, InjuryType from RolesTable where Id = " + id);
            int      injury;
            bool     success = false;
            RoleData role    = null;

            if (sqReader.Read())
            {
                injury = sqReader.GetInt32(sqReader.GetOrdinal("InjuryType"));
                string roleDataStr = sqReader.GetString(sqReader.GetOrdinal("RoleData"));
                roleDataStr = roleDataStr.IndexOf("{") == 0 ? roleDataStr : DESStatics.StringDecder(roleDataStr);
                role        = JsonManager.GetInstance().DeserializeObject <RoleData>(roleDataStr);
                if (injury > 0)
                {
                    sqReader = db.ExecuteQuery("select Id, Num from BagTable where Type = " + ((int)ItemType.Vulnerary) + " and Lv >= " + injury + " and BelongToRoleId = '" + currentRoleId + "' order by Lv");
                    int primaryKeyId = 0;
                    int num          = 0;
                    if (sqReader.Read())
                    {
                        primaryKeyId = sqReader.GetInt32(sqReader.GetOrdinal("Id"));
                        num          = sqReader.GetInt32(sqReader.GetOrdinal("Num"));
                        if (num > 1)
                        {
                            db.ExecuteQuery("update BagTable set Num = " + (num - 1) + " where Id = " + primaryKeyId);
                        }
                        else
                        {
                            db.ExecuteQuery("delete from BagTable where Id = " + primaryKeyId);
                        }
                        db.ExecuteQuery("update RolesTable set InjuryType = " + ((int)InjuryType.None) + " where Id = " + id);
                        success = true;
                    }
                    else
                    {
                        AlertCtrl.Show(string.Format("行囊中并未发现有能够治愈{0}的伤药(需要{1}级伤药)", Statics.GetInjuryName((InjuryType)injury), injury), null);
                    }
                }
            }
            db.CloseSqlConnection();

            if (success && role != null)
            {
                Statics.CreatePopMsg(Vector3.zero, string.Format("<color=\"#FFFF00\">{0}</color>的伤势已经痊愈!", role.Name), Color.white, 30);
                GetHospitalPanelData();
                CallRoleInfoPanelData(false);                 //刷新队伍数据
            }
        }
 public void RefreshView()
 {
     Icon.sprite = Statics.GetIconSprite(roleData.IconId);
     if (roleData.State == RoleStateType.InTeam)
     {
         bg.sprite = Statics.GetSprite("Border12");
     }
     else
     {
         bg.sprite = Statics.GetSprite("Border11");
     }
     Desc.text = string.Format("称谓:{0}\n门派:{1}\n地位:{2}\n状态:{3}", roleData.Name, Statics.GetOccupationName(roleData.Occupation), roleData.IsHost ? "当家" : "门客", Statics.GetInjuryName(roleData.Injury));
     if (roleData.Weapon != null)
     {
         WeaponNameText.text = string.Format("<color=\"{0}\">{1}</color>", Statics.GetQualityColorString(roleData.Weapon.Quality), roleData.Weapon.Name);
         WeaponWidth.rectTransform.sizeDelta = new Vector2(100f * (roleData.Weapon.Width / 100f) * 0.5f, WeaponWidth.rectTransform.sizeDelta.y);
         WeaponIcon.gameObject.SetActive(true);
         WeaponIcon.sprite = Statics.GetIconSprite(roleData.Weapon.IconId);
     }
     else
     {
         WeaponIcon.gameObject.SetActive(false);
     }
     for (int i = 0; i < 3; i++)
     {
         if (roleData.Books.Count > i)
         {
             BookIcons[i].gameObject.SetActive(true);
             BookIcons[i].sprite = Statics.GetIconSprite(roleData.Books[i].IconId);
         }
         else
         {
             BookIcons[i].gameObject.SetActive(false);
         }
     }
     if (roleData.IsHost)
     {
         SelectBtn.gameObject.SetActive(false);
         CancelBtn.gameObject.SetActive(false);
     }
     else
     {
         SelectBtn.gameObject.SetActive(roleData.State == RoleStateType.OutTeam);
         CancelBtn.gameObject.SetActive(roleData.State == RoleStateType.InTeam);
         if (roleData.Injury == InjuryType.Moribund)
         {
             MakeButtonEnable(SelectBtn, false);
             MakeButtonEnable(CancelBtn, false);
         }
     }
 }
Esempio n. 3
0
        void onClick(GameObject e)
        {
            if (!e.GetComponent <Button>().enabled)
            {
                return;
            }
            switch (e.name)
            {
            case "CureBtn":
                if (roleData.Injury != InjuryType.None)
                {
                    ConfirmCtrl.Show(string.Format("要想治愈{0}{1}的伤, 需要使用能够治疗{2}状态的药物, 确定治疗?", roleData.Name, Statics.GetGenderDesc(roleData.Gender), Statics.GetInjuryName(roleData.Injury)), () => {
                        Messenger.Broadcast <int>(NotifyTypes.CureRole, roleData.PrimaryKeyId);
                    });
                }
                break;

            case "Btn":
                Messenger.Broadcast <RoleData>(NotifyTypes.ShowRoleDetailPanel, roleData);
                break;

            default:
                break;
            }
        }
Esempio n. 4
0
 public void UpdateData(RoleData role)
 {
     roleData = role;
     roleData.Init();
     desc = string.Format("称谓:{0}\n门派:{1}\n地位:{2}", roleData.Name, Statics.GetOccupationName(roleData.Occupation), roleData.IsHost ? ("当家" + string.Format("(<color=\"{0}\">{1}</color>)", Statics.GetGenderColor(roleData.Gender), Statics.GetGenderDesc(roleData.Gender))) : "门客");
     info = string.Format("状态:{0}\n气血:{1}/{2}\n外功:{3}\n外防:{4}\n内功:{5}\n内防:{6}\n攻速:{7}\n轻功:{8}\n{9}", Statics.GetInjuryName(roleData.Injury), roleData.HP, roleData.MaxHP, roleData.PhysicsAttack, roleData.PhysicsDefense, roleData.MagicAttack, roleData.MagicDefense, roleData.AttackSpeed, roleData.Dodge, roleData.Desc == "" ? "" : "人物介绍:\n" + roleData.Desc);
 }