public void UpdateData(string id, JArray data, bool willDuring)
 {
     msgStr = data[2].ToString();
     msgStr = msgStr.Replace("<n>", DbManager.Instance.HostData.Name);
     msgStr = msgStr.Replace("<o>", Statics.GetOccupationName(DbManager.Instance.HostData.Occupation));
     msgStr = msgStr.Replace("<s>", Statics.GetGenderDesc(DbManager.Instance.HostData.Gender));
     msgStr = msgStr.Replace("<ss>", DbManager.Instance.HostData.Gender == GenderType.Male ? "哥哥" : "姐姐");
     msgStr = msgStr.Replace("<sss>", DbManager.Instance.HostData.Gender == GenderType.Male ? "公子" : "小姐");
     if (willDuring)
     {
         alphaGroup       = gameObject.AddComponent <CanvasGroup>();
         alphaGroup.alpha = 0;
         alphaGroup.DOFade(1, 0.5f).OnComplete(() => {
             if (alphaGroup != null)
             {
                 Destroy(alphaGroup);
             }
         });
     }
 }
Пример #2
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"));
                role   = JsonManager.GetInstance().DeserializeObject <RoleData>(sqReader.GetString(sqReader.GetOrdinal("RoleData")));
                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>{1}的伤势已经痊愈!", role.Name, Statics.GetGenderDesc(role.Gender)), Color.white, 30);
                GetHospitalPanelData();
                CallRoleInfoPanelData(false);                 //刷新队伍数据
            }
        }
Пример #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;
            }
        }
Пример #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);
 }