Esempio n. 1
0
        /// <summary>
        /// 记录战斗结果
        /// </summary>
        /// <param name="win">If set to <c>true</c> window.</param>
        /// <param name="fightId">Fight identifier.</param>
        /// <param name="star">Star.</param>
        public void SendFightResult(bool win, string fightId, int star, int averageEnemyLv = 0, List <BookData> books = null, float makeAFortuneRate = 0)
        {
            FightData       fight = JsonManager.GetInstance().GetMapping <FightData>("Fights", fightId);
            List <DropData> drops = new List <DropData>();

            if (win)
            {
                long bookExp = averageEnemyLv;
                db = OpenDb();
                SqliteDataReader sqReader = db.ExecuteQuery("select * from FightWinedRecordsTable where FightId = '" + fightId + "' and BelongToRoleId = '" + currentRoleId + "'");
                if (sqReader.HasRows)
                {
                    if (sqReader.Read())
                    {
                        int id       = sqReader.GetInt32(sqReader.GetOrdinal("Id"));
                        int starData = sqReader.GetInt32(sqReader.GetOrdinal("Star"));
                        starData = star > starData ? star : starData;
                        int numData = sqReader.GetInt32(sqReader.GetOrdinal("Num")) + 1;
                        db.ExecuteQuery("update FightWinedRecordsTable set Star = " + starData + ", Num = " + numData + " where Id = " + id);
                    }
                }
                else
                {
                    db.ExecuteQuery("insert into FightWinedRecordsTable (FightId, Star, Num, DateTime, BelongToRoleId) values('" + fightId + "', " + star + ", 1, '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "', '" + currentRoleId + "');");
                }
                db.CloseSqlConnection();

                if (fight.Drops.Count > 0)
                {
                    drops = PushItemToBag(fight.Drops, false, makeAFortuneRate);
                }

                //处理秘籍修为
                if (bookExp > 0)
                {
                    InsertExpIntoBooks(bookExp, books);
                    //添加秘籍修为掉落提示
                    DropData bookExpDrop = new DropData();
                    bookExpDrop.Rate = 100;
                    bookExpDrop.ResourceItemDataId = "301001";
                    bookExpDrop.Num = (int)bookExp;
                    bookExpDrop.MakeJsonToModel();
                    drops.Insert(0, bookExpDrop);
                }

                //将战斗事件从区域大地图上移除
                RemoveFightEvent(fightId);
            }
            else
            {
                //失败后需要计算队伍中侠客的伤势
                MakeRolesInjury();
            }
            Messenger.Broadcast <bool, List <DropData>, FightData>(NotifyTypes.SendFightResultEcho, win, drops, fight);
            //根据战斗胜负处理是否添加临时禁用事件
            Messenger.Broadcast <bool>(NotifyTypes.ReleaseDisableEvent, win);
        }
Esempio n. 2
0
 public void UpdateData(DropData drop)
 {
     dropData = drop;
 }
Esempio n. 3
0
        void onClick(GameObject e)
        {
            if (Time.fixedTime - date <= timeout)
            {
                return;
            }
            switch (e.name)
            {
            case "repairBugBtn0":
                //任务掉落的物品没有背包限制
                DropData drop = new DropData();
                switch (DbManager.Instance.HostData.Occupation)
                {
                case OccupationType.GaiBang:
                    drop.ResourceItemDataId = "100109";
                    break;

                case OccupationType.ShaoLin:
                    drop.ResourceItemDataId = "100110";
                    break;

                case OccupationType.QuanZhen:
                    drop.ResourceItemDataId = "100111";
                    break;

                case OccupationType.XiaoYao:
                    drop.ResourceItemDataId = "100114";
                    break;

                case OccupationType.DaLi:
                    drop.ResourceItemDataId = "100112";
                    break;

                case OccupationType.YueJiaJun:
                    drop.ResourceItemDataId = "100113";
                    break;

                default:
                    break;
                }
                List <DropData> drops = DbManager.Instance.PushItemToBag(new List <DropData>()
                {
                    drop
                }, true);
                if (drops.Count > 0)
                {
                    Messenger.Broadcast <List <DropData> >(NotifyTypes.ShowDropsListPanel, drops);
                }
                Show();
                break;

            case "SureBtn":
            case "Block":
                Back();
                break;

            default:
                break;
            }
//            AlertCtrl.Show("去吧去吧,老夫已为你做了引荐");
        }