当前位置: 首页>>代码示例>>C#>>正文


C# UserNote.GetValue方法代码示例

本文整理汇总了C#中Sinan.FrontServer.UserNote.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# UserNote.GetValue方法的具体用法?C# UserNote.GetValue怎么用?C# UserNote.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sinan.FrontServer.UserNote的用法示例。


在下文中一共展示了UserNote.GetValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ConsumeCoin

        /// <summary>
        /// 晶币变化
        /// </summary>
        /// <param name="note"></param>
        public static void ConsumeCoin(UserNote note)
        {
            PlayerEx ex = note.Player.Social;
            if (ex == null)
                return;
            Variant m = ex.Value.GetValueOrDefault<Variant>("Mentor");
            if (m == null)
                return;
            IList master = m.GetValue<IList>("Master");
            if (master == null || master.Count <= 0)
                return;

            Variant v = master[0] as Variant;
            if (v == null) return;

            PlayerBusiness pb = PlayersProxy.FindPlayerByID(v.GetStringOrDefault("PlayerID"));
            if (pb == null) return;

            int coin = note.GetInt32(0);
            FinanceType ft = note.GetValue<FinanceType>(1);
            int bond = 0;//得到
            int owe = 0;
            if (coin < 0)
            {
                if (note.Player.Level > 39)
                {
                    //高徒
                    bond = Convert.ToInt32(Math.Ceiling(-coin * 0.05));

                }
                else
                {
                    //学徒
                    bond = Convert.ToInt32(Math.Ceiling(-coin * 0.1));
                }
                owe = Convert.ToInt32(Math.Ceiling(-coin * 0.5));
            }
            int reTime = Convert.ToInt32(TipManager.GetMessage(EmailReturn.HameDay));
            if (bond > 0)
            {
                if (pb.AddBond(bond, FinanceType.ConsumeCoin))
                {
                    string msg = string.Format(TipManager.GetMessage(SocialReturn.ConsumeCoin1), note.Player.Name, bond);
                    //"你的徒弟【" + note.Player.Name + "】消费晶币,为感谢师傅的栽培,为师傅送上了【" + bond + "】点劵";
                    //徒弟消费奖励点劵

                    if (EmailAccess.Instance.SendEmail(TipManager.GetMessage(SocialReturn.ConsumeCoin2), TipManager.GetMessage(SocialReturn.FriendsBless8), pb.ID, pb.Name, msg, string.Empty, null, reTime))
                    {
                        if (pb.Online)
                        {
                            pb.Call(EmailCommand.NewEmailTotalR, EmailAccess.Instance.NewTotal(pb.ID));
                        }
                    }
                }
            }

            if (owe > 0)
            {
                if (pb.AddOwe(owe, FinanceType.ConsumeCoin))
                {
                    string msg = string.Format(TipManager.GetMessage(SocialReturn.ConsumeCoin3), owe);
                    // "你获得了【" + owe + "】点感恩值";
                    //徒弟消费奖励感恩值
                    if (EmailAccess.Instance.SendEmail(TipManager.GetMessage(SocialReturn.ConsumeCoin4), TipManager.GetMessage(SocialReturn.FriendsBless8), pb.ID, pb.Name, msg, string.Empty, null, reTime))
                    {
                        if (pb.Online)
                        {
                            pb.Call(EmailCommand.NewEmailTotalR, EmailAccess.Instance.NewTotal(pb.ID));
                            pb.Call(ClientCommand.SendActivtyR, new object[] { "T02", msg });
                        }
                    }
                }
            }

            //晶币消费总量
            //long gce = note.Player.GCE;
        }
开发者ID:abel,项目名称:sinan,代码行数:81,代码来源:MasterBusiness.cs

示例2: IntoBattle

        /// <summary>
        /// 进入玩家和怪的战斗
        /// </summary>
        /// <param name="note"></param>
        private void IntoBattle(UserNote note)
        {
            List<PlayerBusiness> players = FightBase.GetPlayers(note.Player);
            FightObject[] teamA = FightBase.CreateFightPlayers(players);
            FightType fType = (FightType)(note.GetInt32(0));
            FightObject[] teamB = FightBase.CreateApcTeam(players, fType, note[1]);

            string npcID = note.GetString(2);

            if (players.Count == 0 || teamB.Length == 0)
            {
                foreach (var v in players)
                {
                    v.SetActionState(ActionState.Standing);
                }
                return;
            }
            bool isEctype = (note.Player.Scene is SceneEctype || note.Player.Scene is SceneSubEctype);

            FightBusiness fb;
            if (fType == FightType.SceneAPC)
            {
                //打明怪
                SceneApc sab = note.GetValue<SceneApc>(3);
                int subID = note.GetInt32(4);
                fb = new FightSceneApc(teamA, teamB, players, npcID, isEctype, sab, subID);
            }
            else if (fType == FightType.RobAPC)
            {
                SceneApc sab = note.GetValue<SceneApc>(3);
                int subID = note.GetInt32(4);
                RobBusiness rb = note.GetValue<RobBusiness>(5);
                fb = new FightBusinessRobApc(teamA, teamB, players, npcID, isEctype, sab, subID, rb);
            }
            else if (fType == FightType.ProAPC)
            {
                //守护战争明怪
                SceneApc sab = note.GetValue<SceneApc>(3);
                int subID = note.GetInt32(4);
                PartBusiness pb = note.GetValue<PartBusiness>(5);
                fb = new FightBusinessProApc(teamA, teamB, players, npcID, isEctype, sab, subID, pb);
            }
            else
            {
                fb = new FightBusiness(teamA, teamB, players, npcID, isEctype);
            }
            foreach (var player in players)
            {
                player.Fight = fb;
            }
            fb.SendToClinet(FightCommand.StartFight, (int)fType, teamA, teamB);
            fb.Start();
        }
开发者ID:abel,项目名称:sinan,代码行数:57,代码来源:FightMediator.cs

示例3: StartStarShared

        /// <summary>
        /// 暴星分享
        /// </summary>
        /// <param name="note"></param>
        public static void StartStarShared(UserNote note)
        {
            string share = note.PlayerID + "Share";
            try
            {
                if (!m_dic.ContainsKey(share))
                    return;

                string m = "";
                //暴星
                IList o = note.GetValue<IList>(0);
                int power = note.GetInt32(1);
                if (m_dic.TryGetValue(share, out m))
                {
                    int n=0;
                    if (int.TryParse(m, out n))
                    {
                        if (power > n)
                        {
                            power = n;
                        }
                    }
                }

                power = power > 30000 ? 30000 : power;
                int exp = 10 * power + 1000;

                List<string> shareList = new List<string>();
                foreach (string id in o)
                {
                    PlayerBusiness pb = PlayersProxy.FindPlayerByID(id);
                    if (pb.SceneID != note.Player.SceneID)
                        continue;
                    if (note.Player.AState == ActionState.Fight)
                        continue;

                    PlayerEx star = pb.Star;
                    Variant v = star.Value;
                    Variant tmp;
                    if (v.TryGetValue("Share", out tmp))
                    {
                        //分享总次数
                        string msg = "";
                        if (tmp.GetIntOrDefault("Total") >= PartAccess.Instance.MedConfig("Total"))
                        {
                            msg = TipManager.GetMessage(StarReturn.StartStarShared1); //"你已经达到星力爆发分享次数总上限,无法获得经验值!";
                            pb.Call(ClientCommand.SendActivtyR, new object[] { "T02", msg });
                            continue;
                        }

                        //如果是同一开
                        if (tmp.GetLocalTimeOrDefault("ShareTime").Date == DateTime.Now.Date)
                        {
                            //每天最多分享10次暴星经验
                            if (tmp.GetIntOrDefault("Count") >= PartAccess.Instance.MedConfig("EveryDay"))
                            {
                                msg = TipManager.GetMessage(StarReturn.StartStarShared2);// "你已经达到当天的星力爆发分享次数上限,无法获得经验";
                                pb.Call(ClientCommand.SendActivtyR, new object[] { "T02", msg });
                                continue;
                            }
                            tmp.SetOrInc("Count", 1);
                        }
                        else
                        {
                            tmp["Count"] = 1;
                        }
                        tmp.SetOrInc("Exp", exp);
                        tmp["ShareTime"] = DateTime.UtcNow;
                        tmp.SetOrInc("Total", 1);
                    }
                    else
                    {
                        tmp = new Variant();
                        tmp.SetOrInc("Exp", exp);//总共
                        tmp.SetOrInc("Count", 1);//
                        tmp["ShareTime"] = DateTime.UtcNow;//上次分享时间
                        tmp.SetOrInc("Total", 1);//当前分享次数
                        v.Add("Share", tmp);
                    }
                    star.Save();
                    pb.AddExperience(exp, FinanceType.StartStarShared);
                    pb.Call(ClientCommand.UpdateActorR, new PlayerExDetail(star));
                    shareList.Add(pb.ID);
                }

                PlayersProxy.CallAll(StarCommand.StartStarSharedR, new object[] { note.PlayerID, shareList });
            }
            finally
            {
                m_dic.TryRemove(share, out share);
            }
        }
开发者ID:abel,项目名称:sinan,代码行数:96,代码来源:StarBusiness.cs


注:本文中的Sinan.FrontServer.UserNote.GetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。