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


C# GamePlayer.AddTemplate方法代码示例

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


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

示例1: CancelFinish

 public override bool CancelFinish(GamePlayer player)
 { 
     ItemTemplateInfo template = ItemMgr.FindItemTemplate(m_info.Para1);
     if (template != null)
     {
         ItemInfo item = ItemInfo.CreateFromTemplate(template, m_info.Para2, (int)ItemAddType.TurnProperty);
         return player.AddTemplate(item, eBageType.TempBag, m_info.Para2);
     }
     else
     {
         return false;
     }                        
 }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:13,代码来源:TurnPropertyCondition.cs

示例2: AddDailyAward

        //0表示男女,1男2女
        //type 1表示物品,2表示金币,3表示点券,4表示经验,5表示功勋,6表示BUFF
        public static bool AddDailyAward(GamePlayer player)
        {
            if (DateTime.Now.Date == player.PlayerCharacter.LastAward.Date)
            {
                return false;
            }

            //if (player.PlayerCharacter.DayLoginCount > 0)
            //    return false;

            player.PlayerCharacter.DayLoginCount++;
            player.PlayerCharacter.LastAward = DateTime.Now;
            DailyAwardInfo[] infos = GetAllAwardInfo();
            StringBuilder msg = new StringBuilder();
            string full = string.Empty;
            bool has = false;
            foreach (DailyAwardInfo info in infos)
            {
                if (info.Sex != 0 && (player.PlayerCharacter.Sex ? 1 : 2) != info.Sex)
                    continue;

                has = true;
                switch (info.Type)
                {
                    case 1:
                        ItemTemplateInfo itemTemplateInfo = Bussiness.Managers.ItemMgr.FindItemTemplate(info.TemplateID);
                        if (itemTemplateInfo != null)
                        {
                            int itemCount = info.Count;
                            for (int len = 0; len < itemCount; len += itemTemplateInfo.MaxCount)
                            {
                                int count = len + itemTemplateInfo.MaxCount > itemCount ? itemCount - len : itemTemplateInfo.MaxCount;
                                ItemInfo item = ItemInfo.CreateFromTemplate(itemTemplateInfo, count, (int)ItemAddType.DailyAward);
                                item.ValidDate = info.ValidDate;
                                item.IsBinds = info.IsBinds;

                                //if (player.AddItem(item, Game.Server.Statics.ItemAddType.DailyAward, item.GetBagType()) == -1)
                                if (!player.AddTemplate(item,item.Template.BagType,item.Count))
                                {
                                    using (PlayerBussiness db = new PlayerBussiness())
                                    {
                                        item.UserID = 0;
                                        db.AddGoods(item);

                                        MailInfo message = new MailInfo();
                                        message.Annex1 = item.ItemID.ToString();
                                        message.Content = LanguageMgr.GetTranslation("AwardMgr.AddDailyAward.Content", item.Template.Name);
                                        message.Gold = 0;
                                        message.Money = 0;
                                        message.Receiver = player.PlayerCharacter.NickName;
                                        message.ReceiverID = player.PlayerCharacter.ID;
                                        message.Sender = message.Receiver;
                                        message.SenderID = message.ReceiverID;
                                        message.Title = LanguageMgr.GetTranslation("AwardMgr.AddDailyAward.Title", item.Template.Name);
                                        message.Type = (int)eMailType.DailyAward;
                                        db.SendMail(message);

                                        full = LanguageMgr.GetTranslation("AwardMgr.AddDailyAward.Mail");
                                    }
                                }
                            }
                        }
                        break;
                    case 2:
                        player.AddGold(info.Count);
                        break;
                    case 3:
                        player.AddMoney(info.Count);
                        LogMgr.LogMoneyAdd(LogMoneyType.Award, LogMoneyType.Award_Daily, player.PlayerCharacter.ID, info.Count, player.PlayerCharacter.Money, 0, 0, 0, 0, "", "", "");
                        break;
                    case 4:
                        player.AddGP(info.Count);
                        break;
                    case 5:
                        player.AddOffer(info.Count, false);
                        break;
                    case 6:
                        ItemTemplateInfo template = Bussiness.Managers.ItemMgr.FindItemTemplate(info.TemplateID);
                        if (template != null)
                        {
                            AbstractBuffer buffer = BufferList.CreateBufferHour(template, info.ValidDate);
                            buffer.Start(player);
                        }
                        break;
                }
            }

            if (has)
            {
                //player.Out.SendMessage(eMessageType.DailyAward, full + msg.ToString());

                if (!string.IsNullOrEmpty(full))
                {
                    player.Out.SendMailResponse(player.PlayerCharacter.ID, eMailRespose.Receiver);
                }
            }

            return true;
//.........这里部分代码省略.........
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:101,代码来源:AwardMgr.cs


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