예제 #1
0
        private void RankSave()
        {
            RewardInfo rank = new RewardInfo();

            rank.RankId   = -1;
            rank.ModuleId = ModuleId;
            rank.PortalId = PortalId;
            if (Params.ContainsKey("RankId"))
            {
                rank.RankId = Convert.ToInt32(Params["RankId"]);
            }
            if (Params.ContainsKey("RankName"))
            {
                rank.RankName = Params["RankName"].ToString();
            }
            if (Params.ContainsKey("MinPosts"))
            {
                rank.MinPosts = Convert.ToInt32(Params["MinPosts"]);
            }
            if (Params.ContainsKey("MaxPosts"))
            {
                rank.MaxPosts = Convert.ToInt32(Params["MaxPosts"]);
            }
            if (Params.ContainsKey("Display"))
            {
                rank.Display = Params["Display"].ToString();
            }
            RewardController rc = new RewardController();

            rank = rc.Reward_Save(rank);
        }
예제 #2
0
    void UpdatePieceGrid(UIGridItem item)
    {
        if (item == null || item.mScripts == null || item.oData == null)
        {
            return;
        }
        RewardInfo rewardInfo = item.oData as RewardInfo;
        UISprite   color      = item.mScripts[0] as UISprite;
        UITexture  head       = item.mScripts[1] as UITexture;
        UILabel    Name       = item.mScripts[2] as UILabel;
        UISlider   slider     = item.mScripts[3] as UISlider;
        UISprite   btn        = item.mScripts[4] as UISprite;
        UILabel    Num        = item.mScripts[5] as UILabel;
        UISprite   hetong     = item.mScripts[6] as UISprite;

        slider.value = 0;
        ItemInfo info = ItemManager.GetItemInfo(rewardInfo.itemID);

        color.spriteName = UtilTools.StringBuilder("color" + info.color);
        Name.text        = TextManager.GetItemString(rewardInfo.itemID);
        if (info.color == 5)
        {
            hetong.spriteName = "jinhetong";
        }
        else
        {
            hetong.spriteName = "zihetong";
        }

        LoadSprite.LoaderItem(head, rewardInfo.itemID, false);
    }
예제 #3
0
    public void CheckCanGetFlag(bool isCast = false)
    {
        bool flag = false;

        if (this.hasBuy)
        {
            using (List <RewardInfo> .Enumerator enumerator = this.itemList.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    RewardInfo current = enumerator.get_Current();
                    flag = (current.canGet && !current.hadGet && !current.overdue);
                    if (flag)
                    {
                        break;
                    }
                }
            }
        }
        if (isCast)
        {
            this.SetTipOfCanGet(flag);
        }
        else
        {
            this.IsShowTipsOfCanGet = flag;
        }
    }
예제 #4
0
    public void LoadLowData()
    {
        {
            TextAsset    data   = Resources.Load("TestJson/GatchaReward_Gatcha", typeof(TextAsset)) as TextAsset;
            StringReader sr     = new StringReader(data.text);
            string       strSrc = sr.ReadToEnd();
            JSONObject   Gatcha = new JSONObject(strSrc);

            for (int i = 0; i < Gatcha.list.Count; i++)
            {
                GatchaInfo tmpInfo = new GatchaInfo();
                tmpInfo.Idx      = (uint)Gatcha[i]["Idx_ui"].n;
                tmpInfo.GatchaId = (uint)Gatcha[i]["GatchaId_ui"].n;
                tmpInfo.GroupIdx = (uint)Gatcha[i]["GroupIdx_ui"].n;

                GatchaInfoList.Add(tmpInfo);
            }
        }

        {
            TextAsset    data   = Resources.Load("TestJson/GatchaReward_Reward", typeof(TextAsset)) as TextAsset;
            StringReader sr     = new StringReader(data.text);
            string       strSrc = sr.ReadToEnd();
            JSONObject   Reward = new JSONObject(strSrc);

            for (int i = 0; i < Reward.list.Count; i++)
            {
                RewardInfo tmpInfo = new RewardInfo();
                //tmpInfo.LogIdx = (uint)Reward[i]["LogIdx_ui"].n;
                tmpInfo.GatchIdx    = (uint)Reward[i]["GatchIdx_ui"].n;
                tmpInfo.ClassType   = (byte)Reward[i]["ClassType_b"].n;
                tmpInfo.Type        = (byte)Reward[i]["Type_b"].n;
                tmpInfo.ItemIdx     = (uint)Reward[i]["ItemIdx_ui"].n;
                tmpInfo.ItemIdxRate = (uint)Reward[i]["ItemIdxRate_ui"].n;
                tmpInfo.ShardMin    = (uint)Reward[i]["ShardMin_ui"].n;
                tmpInfo.ShardMax    = (uint)Reward[i]["ShardMax_ui"].n;

                RewardInfoList.Add(tmpInfo);
            }
        }
        {
            TextAsset    data        = Resources.Load("TestJson/GatchaReward_FixedReward", typeof(TextAsset)) as TextAsset;
            StringReader sr          = new StringReader(data.text);
            string       strSrc      = sr.ReadToEnd();
            JSONObject   FixedReward = new JSONObject(strSrc);

            for (int i = 0; i < FixedReward.list.Count; i++)
            {
                FixedRewardInfo tmpInfo = new FixedRewardInfo();
                tmpInfo.ID        = (uint)FixedReward[i]["ID_ui"].n;
                tmpInfo.RewardId  = (uint)FixedReward[i]["RewardId_ui"].n;
                tmpInfo.ClassType = (byte)FixedReward[i]["ClassType_b"].n;
                tmpInfo.Type      = (byte)FixedReward[i]["Type_b"].n;
                tmpInfo.ItemId    = (uint)FixedReward[i]["ItemId_ui"].n;
                tmpInfo.ItemCount = (uint)FixedReward[i]["ItemCount_ui"].n;

                FixedRewardInfoList.Add(tmpInfo);
            }
        }
    }
예제 #5
0
    private void AddScrollCell(int index, GouMaiXiangGuan config)
    {
        RewardInfo investItemInfo = InvestFundManager.Instance.GetInvestItemInfo(config.type);
        bool       canGet         = false;
        bool       hasGot         = false;
        bool       isOver         = false;

        if (investItemInfo != null)
        {
            canGet = investItemInfo.canGet;
            hasGot = investItemInfo.hadGet;
            isOver = investItemInfo.overdue;
        }
        string    title     = string.Format(GameDataUtils.GetChineseContent(508201, false), config.type);
        string    count     = config.nameId.ToString();
        Transform transform = this.m_ScrollList.get_transform().FindChild("InvestItem" + index);

        if (transform != null)
        {
            transform.get_gameObject().SetActive(true);
            transform.GetComponent <InvestItem>().UpdateItem(config.type, title, count, canGet, hasGot, isOver, new ButtonCustom.VoidDelegateObj(this.OnDayBtnClick));
        }
        else
        {
            GameObject instantiate2Prefab = ResourceManager.GetInstantiate2Prefab("InvestItem");
            instantiate2Prefab.get_transform().SetParent(this.m_ScrollList.get_transform(), false);
            instantiate2Prefab.set_name("InvestItem" + index);
            instantiate2Prefab.SetActive(true);
            instantiate2Prefab.GetComponent <InvestItem>().UpdateItem(config.type, title, count, canGet, hasGot, isOver, new ButtonCustom.VoidDelegateObj(this.OnDayBtnClick));
        }
    }
        // POST api/<controller>

        /*public Hashtable Post([FromBody] int id_crimal, [FromBody] int rule, [FromBody] DateTime dateTime, [FromBody] int score, [FromBody] string kind, [FromBody] string detail)
         * {
         *  Hashtable ht = new Hashtable();
         *  RewardInfo ai = new RewardInfo();
         *  int admin = UserInfo.GetUserIdFromCookie(HttpContext.Current);
         *  try
         *  {
         *      ht.Add("state", ai.AddOne(id_crimal, rule, dateTime, admin, score, kind, detail));
         *  }
         *  catch (Exception e)
         *  {
         *      ht.Add("state", false);
         *      ht.Add("reason", e.Message);
         *  }
         *  return ht;
         * }*/

        // POST api/<controller>
        public Hashtable Post(int worker_id, int rule_id, DateTime date, int score)
        {
            int        admin = UserInfo.GetUserIdFromCookie(HttpContext.Current);
            Hashtable  ht    = new Hashtable();
            Hashtable  data  = new Hashtable();
            RewardInfo ai    = new RewardInfo();

            try
            {
                Models.exam_record record = ai.AddOne(worker_id, rule_id, date, admin, score);
                ht.Add("code", 20000);
                int id_record = record.idexam_record;
                data.Add("record_id", id_record);
                data.Add("worker_name", new Services.WorkerManage.PersonInfo().GetPersonName((int)record.id_crimial));
                data.Add("context", new RuleInfo().GetContent((int)record.id_rule));
                data.Add("group_admin_name", new AdminInfo().GetGroupAdminName((int)record.group_check_id));
            }
            catch (Exception e)
            {
                if (ht.ContainsKey("code"))
                {
                    ht.Remove("code");
                }
                ht.Add("code", 40000);
                data.Add("message", e.Message);
            }
            ht.Add("data", data);
            return(ht);
        }
예제 #7
0
        private void CancelBounty(BasePlayer player, IPlayer target)
        {
            PlayerData playerData;

            if (!storedData.players.TryGetValue(ulong.Parse(target.Id), out playerData))
            {
                SendReply(player, string.Format(msg("no_bounty_placed", player.userID), target.Name));
                return;
            }

            PlayerData.BountyInfo bountyInfo = playerData.activeBounties.Find(x => x.initiatorId == player.userID) ?? null;
            if (bountyInfo == null)
            {
                SendReply(player, string.Format(msg("no_bounty_placed", player.userID), target.Name));
                return;
            }

            RewardInfo rewardInfo = storedData.rewards[bountyInfo.rewardId];

            GivePlayerRewards(player, rewardInfo);
            storedData.rewards.Remove(bountyInfo.rewardId);
            playerData.activeBounties.Remove(bountyInfo);

            BasePlayer targetPlayer = target.Object as BasePlayer;

            if (targetPlayer != null)
            {
                BroadcastToPlayer(targetPlayer, string.Format(msg("bounty_cancelled_target", targetPlayer.userID), player.displayName));
            }

            BroadcastToPlayer(player, string.Format(msg("bounty_cancelled_initiator", player.userID), target.Name));
        }
예제 #8
0
            public override void Set(IReadOnlyList <string> fields)
            {
                Id = ParseInt(fields[0]);
                var info = new RewardInfo(fields.Skip(1).ToArray());

                Rewards = new List <RewardInfo> {
                    info
                };
            }
예제 #9
0
        public static void Award(Mobile to)
        {
            RewardInfo info = m_Rewards[Utility.Random(m_Rewards.Length)];

            Item reward = (Item)Activator.CreateInstance(info.Type);

            to.PlaceInBackpack(reward);
            to.SendLocalizedMessage(1074360, String.Format("#{0}", info.Cliloc.ToString()));                 // You receive a reward: ~1_REWARD~
        }
        public Hashtable Get(int page, int limit, int group_id, string worker_name, int worker_id)
        {
            Hashtable  ht   = new Hashtable();
            Hashtable  data = new Hashtable();
            RewardInfo ai   = new RewardInfo();

            ht.Add("code", 20000);
            data.Add("items", Hashtables(ai.GetRewardInfo((page - 1) * limit, limit, group_id)));
            data.Add("total", ai.GetSize(group_id));
            ht.Add("data", data);
            return(ht);
        }
예제 #11
0
        private void TranslateReward(RewardInfo reward)
        {
            foreach (var item in reward.countedItems)
            {
                item.type = invasionTranslator.Translate(item.type);
            }

            foreach (var t in reward.countedItems)
            {
                t.type = dictTranslator.Translate(t.type);
            }
        }
예제 #12
0
 public RewardInfo(RewardInfo rewardInfo)
 {
     mItemID           = rewardInfo.mItemID;
     mGID              = rewardInfo.mGID;
     mFixedNum         = rewardInfo.mFixedNum;
     mNum              = rewardInfo.mNum;
     mVocation         = rewardInfo.mVocation;
     mEffectByLevel    = rewardInfo.mEffectByLevel;
     mLvLimit          = rewardInfo.mLvLimit;
     mIsBind           = rewardInfo.mIsBind;
     mOpenSysId        = rewardInfo.mOpenSysId;
     mShowColorEffect2 = rewardInfo.mShowColorEffect2;
 }
예제 #13
0
        public static string ToString(RewardInfo reward)
        {
            var rewards = new List <string>();

            if (reward.credits > 0)
            {
                rewards.Add($"{reward.credits} cr");
            }

            foreach (var item in reward.countedItems)
            {
                rewards.Add($"{item.count}x{item.type}");
            }

            return(string.Join(" + ", rewards));
        }
        // GET api/<controller>
        public Hashtable Get(int id)
        {
            Hashtable  ht = new Hashtable();
            RewardInfo ai = new RewardInfo();

            try
            {
                ht.Add("state", ai.DeleteOne(id));
            }
            catch (Exception e)
            {
                ht.Add("state", false);
                ht.Add("reason", e.Message);
            }
            return(ht);
        }
    // 보상 리스트 가져오기
    List <RewardInfo> GetAttendRewardList(DataGuildReward data)
    {
        List <RewardInfo> rewardList = new List <RewardInfo>();

        for (int i = 0; i < data.GetREWARD_TYPECount(); i++)
        {
            EGoodsType goods = (EGoodsType)data.GetREWARD_TYPE(i);
            if (goods != EGoodsType.None)
            {
                string     rewardValue = data.GetREWARD_VALUE(i);
                RewardInfo reward      = new RewardInfo(goods, rewardValue);
                rewardList.Add(reward);
            }
        }
        return(rewardList);
    }
예제 #16
0
        public Hashtable Post([FromBody] int id_exam, [FromBody] int rule, [FromBody] DateTime dateTime, [FromBody] int score, [FromBody] string kind, [FromBody] string detail)
        {
            Hashtable  ht    = new Hashtable();
            RewardInfo ai    = new RewardInfo();
            int        admin = UserInfo.GetUserIdFromCookie(HttpContext.Current);

            try
            {
                ht.Add("state", ai.ChangeContext(id_exam, rule, dateTime, admin, score, kind, detail));
            }
            catch (Exception e)
            {
                ht.Add("state", false);
                ht.Add("reason", e.Message);
            }
            return(ht);
        }
예제 #17
0
    private void showResult()
    {
        mLock.gameObject.SetActive(mCurrentIndex == INDEX_LOCK);
        mOpen.gameObject.SetActive(mCurrentIndex == INDEX_OPEN);
        if (mCurrentIndex == INDEX_OPEN)
        {
            //打开红包
            mReward             = RewardManager.getNextReward(DataManager.getCurrentMoney());
            _mOverAddMoney.text = $"{mReward.reward:F2}usd";
            _mOverAddMoney.text = "<size=64>" + mReward.reward.ToString("F2") + "</size>" + "usd";
            DataManager.addMoney((float)mReward.reward);

            _mOverTotalMoney.GetComponent <TMP_Text>().text =
                $"{" BALANCE:" + DataManager.getCurrentMoney().ToString("F2") + "usd"}";
        }

        Invoke("showClose", 2f);
    }
예제 #18
0
    private void ScrollToAvailableCell()
    {
        Vector3 localPosition = new Vector3(0f, this.m_ScrollInvest.get_sizeDelta().y, 0f);

        if (InvestFundManager.Instance.hasBuy && InvestFundManager.Instance.hasGet)
        {
            List <RewardInfo> itemList = InvestFundManager.Instance.itemList;
            for (int i = 0; i < itemList.get_Count(); i++)
            {
                RewardInfo rewardInfo = itemList.get_Item(i);
                if (rewardInfo.canGet && !rewardInfo.hadGet && !rewardInfo.overdue)
                {
                    localPosition.y += (float)(i + 1) * (this.m_ScrollList.get_cellSize().y + this.m_ScrollList.get_spacing().y);
                    break;
                }
            }
        }
        this.m_ScrollList.GetComponent <RectTransform>().set_localPosition(localPosition);
    }
예제 #19
0
    public override void onloaded(AssetBundles.NormalRes data)
    {
        byte[] asset = (data as AssetBundles.BytesRes).m_bytes;
        if (asset == null)
        {
            return;
        }

        TbXmlNode docNode = TbXml.Load(asset).docNode;

        if (docNode == null)
        {
            return;
        }
        List <TbXmlNode> xmlNodeList = docNode.GetNodes("Object/Property");
        int xmlNodeListLength        = xmlNodeList.Count;

        if (xmlNodeListLength < 1)
        {
            return;
        }
        RewardInfo info;

        for (int i = 0; i < xmlNodeList.Count; ++i)
        {
            TbXmlNode node = xmlNodeList[i] as TbXmlNode;
            info          = new RewardInfo();
            info.itemID   = node.GetStringValue("ID");
            info.itemType = node.GetIntValue("Type");
            info.amount   = node.GetIntValue("Contract");
            if (configList.ContainsKey(info.itemID))
            {
                configList[info.itemID] = info;
            }
            else
            {
                configList.Add(info.itemID, info);
            }
        }
        asset = null;
        base.onloaded(data);
    }
    // Get RewardList
    List <RewardInfo> GetPackageInfos(uint id, EPackageRewardType selectType = EPackageRewardType.None, DataPackageShop shop = null)
    {
        List <RewardInfo> infos   = new List <RewardInfo>();
        DataPackage       package = DataPackage.GetByID(id);

        for (int i = 0; i < package.GetREWARD_TYPECount(); i++)
        {
            if (selectType != EPackageRewardType.None && selectType != (EPackageRewardType)package.GetPRICE_TYPE(i))
            {
                continue;
            }

            RewardInfo info = new RewardInfo();
            info.type  = (EGoodsType)package.GetREWARD_TYPE(i);
            info.value = package.GetREWARD_VALUE(i);

            infos.Add(info);
        }

        if (shop != null && selectType == EPackageRewardType.Bonus)
        {
            RewardInfo bonus = ShopHelper.GetMonthlyBonus(shop);
            if (bonus != null)
            {
                RewardInfo searchInfo = infos.Find(x => x.type == bonus.type);
                if (searchInfo != null) // 같은 타입이면 갯수증가
                {
                    searchInfo.AddCount(bonus.GetCount());
                }
                else // 다른 타입이면 리스트 추가
                {
                    infos.Add(bonus);
                }
            }
        }

        return(infos);
    }
예제 #21
0
        private void GivePlayerRewards(BasePlayer player, RewardInfo rewardInfo)
        {
            if (rewardInfo.econAmount > 0 && Economics)
            {
                Economics?.Call("Deposit", player.UserIDString, (double)rewardInfo.econAmount);
            }

            if (rewardInfo.rpAmount > 0 && ServerRewards)
            {
                ServerRewards?.Call("AddPoints", player.userID, rewardInfo.rpAmount);
            }

            if (rewardInfo.rewardItems.Count > 0)
            {
                foreach (RewardInfo.ItemData itemData in rewardInfo.rewardItems)
                {
                    Item item = CreateItem(itemData);
                    player.GiveItem(item, BaseEntity.GiveItemReason.PickedUp);
                }
            }

            SendReply(player, msg("reward_claimed", player.userID));
        }
예제 #22
0
    void UpdateRewardGrid(UIGridItem item)
    {
        if (item == null || item.mScripts == null || item.oData == null)
        {
            return;
        }
        RewardInfo rewardInfo = item.oData as RewardInfo;
        UISprite   color      = item.mScripts[0] as UISprite;
        UITexture  head       = item.mScripts[1] as UITexture;
        UILabel    Name       = item.mScripts[2] as UILabel;
        UISprite   stars      = item.mScripts[3] as UISprite;

        item.onClick = OnClickItem;
        Name.text    = TextManager.GetItemString(rewardInfo.itemID);
        UISprite[] star = stars.GetComponentsInChildren <UISprite>();
        stars.gameObject.SetActive(rewardInfo.itemType == 7);
        if (rewardInfo.itemType != 7)
        {
            LoadSprite.LoaderItem(head, rewardInfo.itemID, false);
            ItemInfo info = ItemManager.GetItemInfo(rewardInfo.itemID);
            color.spriteName = UtilTools.StringBuilder("color" + info.color);
        }
    }
예제 #23
0
    /**
     * 获取下一次的奖励值
     */
    public static RewardInfo getNextReward(double currentMoney)
    {
        if (mCurrentList == null)
        {
            mCurrentList = getAllReward();
        }

        RewardInfo reward = null;

        foreach (var info in mCurrentList)
        {
            if (!(info.money > currentMoney))
            {
                continue;
            }
            reward = info;
            break;
        }

        return(reward ?? (reward = new RewardInfo {
            reward = 0f
        }));
    }
        // PUT api/values/5
        public Hashtable Put(int id, int worker_id, int rule_id, DateTime date, int score)
        {
            Hashtable  ht    = new Hashtable();
            Hashtable  data  = new Hashtable();
            RewardInfo ai    = new RewardInfo();
            int        admin = UserInfo.GetUserIdFromCookie(HttpContext.Current);

            try
            {
                ht.Add("code", 20000);
                ai.ChangeContext(id, rule_id, date, admin, score, null, null);
            }
            catch (Exception e)
            {
                if (ht.ContainsKey("code"))
                {
                    ht.Remove("code");
                }
                ht.Add("code", 40000);
                data.Add("message", e.Message);
            }
            ht.Add("data", data);
            return(ht);
        }
    // 유저 정보를 불러오는 메서드
    // 유저 정보에 대한 파일이 없다면 생성한다.
    public void LoadUserInfo()
    {
        string fullpathUserInfo = Application.persistentDataPath + "/user_info.json";

        if (File.Exists(fullpathUserInfo))
        {
            var textUserInfo = File.ReadAllText(fullpathUserInfo);
            this.UserInfo = JsonConvert.DeserializeObject <UserInfo>(textUserInfo);
            Debug.LogFormat("UserInfo::LoadInfos");
        }
        else
        {
            var dataManager = DataManager.GetInstance();
            var infoManager = InfoManager.Getinstance();

            var dicMissionDatas = dataManager.GetMissionDatasAll();
            var dicRewardDatas  = dataManager.GetRewardDatasAll();

            foreach (var pair in dicMissionDatas)
            {
                var         data        = pair.Value;
                MissionInfo missionInfo = new MissionInfo();
                missionInfo.id = data.id;
                infoManager.UserInfo.dicMssionInfos.Add(missionInfo.id, missionInfo);
            }
            foreach (var pair in dicRewardDatas)
            {
                var        data       = pair.Value;
                RewardInfo rewardInfo = new RewardInfo();
                rewardInfo.id = data.id;
                infoManager.UserInfo.dicRewardInfos.Add(rewardInfo.id, rewardInfo);
            }

            SaveUserInfo();
        }
    }
예제 #26
0
            public async Task <Response> Handle(Request request, CancellationToken cancellationToken)
            {
                Response response = null;

                try
                {
                    if (!string.IsNullOrEmpty(request.Name))
                    {
                        using (MemoryStream ms = new MemoryStream())
                        {
                            await request.File.CopyToAsync(ms);

                            RewardInfo reward = new RewardInfo
                            {
                                Name = request.Name,
                                Icon = ms.ToArray()
                            };

                            await Repository.Create(reward);

                            response = new Response
                            {
                                Id = reward.Id
                            };
                        }
                    }
                    else
                    {
                    }
                }
                catch (Exception ex)
                {
                    throw;
                }
                return(response);
            }
예제 #27
0
        private string GetRank()
        {
            int RankId = -1;

            if (Params.ContainsKey("RankId"))
            {
                RankId = Convert.ToInt32(Params["RankId"]);
            }
            RewardController rc   = new RewardController();
            RewardInfo       rank = rc.Reward_Get(PortalId, ModuleId, RankId);
            string           sOut = "{";

            sOut += Utilities.JSON.Pair("RankId", rank.RankId.ToString());
            sOut += ",";
            sOut += Utilities.JSON.Pair("RankName", rank.RankName);
            sOut += ",";
            sOut += Utilities.JSON.Pair("MinPosts", rank.MinPosts.ToString());
            sOut += ",";
            sOut += Utilities.JSON.Pair("MaxPosts", rank.MaxPosts.ToString());
            sOut += ",";
            sOut += Utilities.JSON.Pair("Display", rank.Display.ToLowerInvariant().Replace("activeforums/ranks", "activeforums/images/ranks"));
            sOut += "}";
            return(sOut);
        }
예제 #28
0
    /// <summary>
    /// GridItem点击事件
    /// </summary>
    void OnClickItem(UIGridItem item)
    {
        if (item == null || item.mScripts == null || item.oData == null)
        {
            return;
        }
        RewardInfo rewardInfo = item.oData as RewardInfo;

        if (rewardInfo.itemType != 7)
        {
            ShowItemInfo showItemInfo = new ShowItemInfo();
            ItemMediator.panelType = PanelType.Info;
            showItemInfo.sellItem  = null;
            showItemInfo.useItem   = null;
            List <object> list = new List <object>();
            list.Add(showItemInfo);
            list.Add(rewardInfo);
            Facade.SendNotification(NotificationID.ItemInfo_Show, list);
        }
        else if (rewardInfo.itemType == 7)
        {
            Facade.SendNotification(NotificationID.Team_Show, rewardInfo.itemID);
        }
    }
예제 #29
0
 public void Init()
 {
     instance = new RewardInfo();
 }
예제 #30
0
		private void RankSave()
		{
			RewardInfo rank = new RewardInfo();
			rank.RankId = -1;
			rank.ModuleId = ModuleId;
			rank.PortalId = PortalId;
			if (Params.ContainsKey("RankId"))
			{
				rank.RankId = Convert.ToInt32(Params["RankId"]);
			}
			if (Params.ContainsKey("RankName"))
			{
				rank.RankName = Params["RankName"].ToString();
			}
			if (Params.ContainsKey("MinPosts"))
			{
				rank.MinPosts = Convert.ToInt32(Params["MinPosts"]);
			}
			if (Params.ContainsKey("MaxPosts"))
			{
				rank.MaxPosts = Convert.ToInt32(Params["MaxPosts"]);
			}
			if (Params.ContainsKey("Display"))
			{
				rank.Display = Params["Display"].ToString();
			}
			RewardController rc = new RewardController();
			rank = rc.Reward_Save(rank);
		}
예제 #31
0
        public static ArrayList ParseRewards(XmlDbRow dr, string[] columnKeys, int numRewards)
        {
            try
            {
                ArrayList list = new ArrayList();
                for (int i = 0; i < numRewards; i++)
                {
                    bool flag = false;
                    List<string> entry = dr.GetStringList(columnKeys[i], ',', false);
                    if (entry.Count > 0)
                    {
                        RewardType type;
                        for (int j = 0; j < entry.Count; j++)
                        {
                            entry[j] = entry[j].Trim();
                        }

                        if (ParserFunctions.TryParseEnum<RewardType>(entry[0], out type, RewardType.Undefined))
                        {
                            RewardInfo info = null;
                            switch (type)
                            {
                                case RewardType.BookSkill:
                                    info = RewardsManager.ParseBookSkillRewardInfo(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.Buff:
                                    info = RewardsManager.ParseBuffRewardInfo(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.CareerDemotion:
                                case RewardType.CareerFired:
                                case RewardType.CareerPromotion:
                                case RewardType.UnknownRecipe:
                                case RewardType.UnlearnedComposition:
                                case RewardType.CompedMeal:
                                case RewardType.BookQualityIncrease:
                                case RewardType.ConcertsPerformed:
                                    info = new RewardInfo();
                                    info.mType = type;
                                    flag = true;
                                    break;

                                case RewardType.Ingredient:
                                    info = RewardsManager.ParseIngredientRewardInfo(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.Money:
                                    info = RewardsManager.ParseMoneyRewardInfo(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.RandomGroupMeal:
                                    info = RewardsManager.ParseRandomGroupMealRewardInfo(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.RandomPlantable:
                                    info = RewardsManager.ParseRandomPlantableRewardInfo(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.RandomObject:
                                    info = RewardsManager.ParseRandomObjectReward(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.SkillPercentage:
                                    info = ParseSkillRewardInfo(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.RandomFish:
                                    info = RewardsManager.ParseRandomFishRewardInfo(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.PaintingValueBoost:
                                    info = RewardsManager.ParsePaintingValueBoostRewardInfo(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.GroupMeal:
                                    info = RewardsManager.ParseGroupMealReward(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.ObjectInMail:
                                    info = RewardsManager.ParseObjectInMailReward(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.Harvestable:
                                    info = RewardsManager.ParseHarvestableRewardInfo(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.OmniPlantSeeds:
                                    info = RewardsManager.ParseOmniPlantSeedsRewardInfo(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.AncientCoin:
                                    info = RewardsManager.ParseAncientCoinInfo(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.VisaPoints:
                                    info = RewardsManager.ParseVisaPointsInfo(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.TreasureComponentRow:
                                    info = RewardsManager.ParseTreasureComponentRow(entry);
                                    flag = info != null;
                                    break;

                                default:
                                    info = new RewardInfo();
                                    info.mType = type;
                                    if (entry.Count == 0x2)
                                    {
                                        flag = int.TryParse(entry[0x1], out info.mAmount);
                                    }
                                    break;
                            }
                            if (flag)
                            {
                                list.Add(info);
                            }
                        }
                        else
                        {
                            Type rewardType = dr.GetClassType(columnKeys[i]);
                            if (rewardType != null)
                            {
                                RewardInfoEx reward = (RewardInfoEx)rewardType.GetConstructor(new Type[0]).Invoke(new object[0]);
                                if (reward != null)
                                {
                                    list.Add(reward);
                                }
                                else
                                {
                                    BooterLogger.AddError("Unknown reward: " + dr.GetString(columnKeys[i]));
                                }
                            }
                            else
                            {
                                BooterLogger.AddError("Unknown reward: " + dr.GetString(columnKeys[i]));
                            }
                        }
                    }
                }

                if (list.Count != 0)
                {
                    return list;
                }
            }
            catch (Exception e)
            {
                Common.Exception("ParseRewards", e);
            }
            return null;
        }
예제 #32
0
        /// <summary>
        /// 门店内员工排名
        /// 排名规则:
        /// 1.取出打赏金额大于零的员工
        /// 2.比较打赏金额,(金额高的往前排)
        /// 3.金额相同,比较评价等级 (等级高的往前排)
        /// 4.如果还相同,比较打赏时间(时间靠前,往前排)
        /// </summary>
        /// <param name="pRequest"></param>
        /// <returns></returns>
        protected override GetTopRewardListRD ProcessRequest(DTO.Base.APIRequest <GetTopRewardListRP> pRequest)
        {
            var rd         = new GetTopRewardListRD();
            var customerId = CurrentUserInfo.ClientID;

            var trrBll  = new T_RewardRecordBLL(CurrentUserInfo);
            var userBll = new T_UserBLL(CurrentUserInfo);

            //获取员工列表(门店内)
            var userList = userBll.QueryByEntity(new T_UserEntity()
            {
                customer_id = customerId
            }, null);
            var userService = new cUserService(CurrentUserInfo);

            CurrentUserInfo.CurrentUserRole.UnitId = string.IsNullOrEmpty(CurrentUserInfo.CurrentUserRole.UnitId) ? "" : CurrentUserInfo.CurrentUserRole.UnitId;
            var para_unit_id = CurrentUserInfo.CurrentUserRole.UnitId;

            var maxRowCount   = Utils.GetIntVal(Request("limit"));
            var startRowIndex = Utils.GetIntVal(Request("start"));
            var rowCount      = maxRowCount > 0 ? maxRowCount : 999;   //每页行数
            var startIndex    = startRowIndex > 0 ? startRowIndex : 0; //当前页的起始行数

            var userdata = new JIT.CPOS.BS.Entity.User.UserInfo();

            if (string.IsNullOrEmpty(CurrentUserInfo.CurrentUserRole.UnitId))
            {
                userdata = userService.SearchUserListByUnitID(string.Empty, string.Empty, string.Empty, string.Empty,
                                                              rowCount, startIndex, CurrentUserInfo.CurrentUserRole.UnitId, para_unit_id, string.Empty, string.Empty);
            }
            else
            {
                userdata = userService.SearchUserListByUnitID(string.Empty, string.Empty, string.Empty, string.Empty,
                                                              rowCount, startIndex,
                                                              CurrentUserInfo.CurrentUserRole.UnitId, para_unit_id, string.Empty, string.Empty);
            }

            var orderBys = new OrderBy[1];

            orderBys[0] = new OrderBy()
            {
                FieldName = "CreateTime", Direction = OrderByDirections.Asc
            };
            var trrList = trrBll.QueryByEntity(new T_RewardRecordEntity()
            {
                PayStatus = 2, CustomerId = customerId
            }, orderBys);

            var oeBll  = new ObjectEvaluationBLL(CurrentUserInfo);
            var oeList = oeBll.QueryByEntity(new ObjectEvaluationEntity()
            {
                Type = 4, CustomerID = customerId
            }, null);
            var allOE = (from p in oeList.AsEnumerable()
                         group p by p.ObjectID into g
                         select new
            {
                g.Key,
                SumValue = g.Average(p => p.StarLevel)
            });

            var allRewards = (from p in trrList.AsEnumerable()
                              group p by p.RewardedOP into g
                              select new
            {
                g.Key,
                SumValue = g.Sum(p => p.RewardAmount)
            }).Where(g => g.SumValue > 0).OrderByDescending(g => g.SumValue);

            var rewardCount = allRewards.ToList().Count;

            //var top10Rewards = allRewards.Take(10);

            //金额相同,比较评价等级 (等级高的往前排)

            rd.RewardList = new List <RewardInfo>();
            rd.MyReward   = new RewardInfo();

            var index = 1;

            foreach (var item in allRewards)
            {
                var tmpRewardInfo = new RewardInfo();
                //var userinfo = userList.Where(t => t.user_id == item.Key).ToArray().FirstOrDefault();
                var userinfo = userdata.UserInfoList.Where(t => t.User_Id == item.Key).ToArray().FirstOrDefault();
                var oeinfo   = allOE.Where(t => t.Key == item.Key).ToArray().FirstOrDefault();
                if (userinfo != null)
                {
                    tmpRewardInfo = new RewardInfo()
                    {
                        UserID                                          = userinfo.User_Id,
                        UserName                                        = userinfo.User_Name,
                        UserPhoto                                       = userinfo.imageUrl,
                        StarLevel                                       = oeinfo != null?Convert.ToInt32(oeinfo.SumValue) : 0,
                                                           Rank         = index,
                                                           RewardIncome = item.SumValue
                    };
                    rd.RewardList.Add(tmpRewardInfo);
                    if (userinfo.User_Id == pRequest.UserID)
                    {
                        rd.MyReward = tmpRewardInfo;
                    }

                    index++;
                }
            }

            if (string.IsNullOrEmpty(rd.MyReward.UserID))//Top10之外
            {
                //var userinfo = userList.Where(t => t.user_id == pRequest.UserID).ToArray().FirstOrDefault();
                var     userinfo       = userdata.UserInfoList.Where(t => t.User_Id == pRequest.UserID).ToArray().FirstOrDefault();
                var     oeinfo         = allOE.Where(t => t.Key == pRequest.UserID).ToArray().FirstOrDefault();
                var     myReward       = allRewards.Where(t => t.Key == pRequest.UserID).FirstOrDefault();
                decimal?myRewardIncome = 0;
                if (myReward != null)
                {
                    myRewardIncome = myReward.SumValue != null ? myReward.SumValue : 0;
                    rewardCount    = allRewards.Where(g => g.SumValue > myReward.SumValue).ToList().Count;
                }
                var myStarLevel = oeinfo != null?Convert.ToInt32(oeinfo.SumValue) : 0;

                if (userinfo != null)
                {
                    rd.MyReward = new RewardInfo()
                    {
                        UserID       = userinfo.User_Id,
                        UserName     = userinfo.User_Name,
                        UserPhoto    = userinfo.imageUrl,
                        StarLevel    = myStarLevel,
                        Rank         = myRewardIncome > 0 ? rewardCount + 1 : 0,
                        RewardIncome = myRewardIncome
                    };
                }
            }

            return(rd);
        }
예제 #33
0
        private static RewardInfo ParseSkillRewardInfo(List<string> entry)
        {
            if (entry.Count == 0x3)
            {
                RewardInfo info = new RewardInfo();
                info.mType = RewardType.SkillPercentage;

                // Custom
                SkillNames names = SkillManager.sSkillEnumValues.ParseEnumValue(entry[1]);

                info.mGuid = (ulong)names;
                if (int.TryParse(entry[0x2], out info.mAmount))
                {
                    return info;
                }
            }
            return null;
        }
예제 #34
0
        private void SetCount(RewardInfo Reward)
        {
            if (Reward.AwardA > 0)
                mAwardACount += Reward.AwardA;

            if (Reward.AwardB > 0)
                mAwardBCount += Reward.AwardB;

            if (Reward.AwardC > 0)
                mAwardCCount += Reward.AwardC;

            if (Reward.FaultA > 0 && !Reward.Cleared)
                mFaultACount += Reward.FaultA;

            if (Reward.FaultB > 0 && !Reward.Cleared)
                mFaultBCount += Reward.FaultB;

            if (Reward.FaultC > 0 && !Reward.Cleared)
                mFaultCCount += Reward.FaultC;
        }