Exemple #1
0
        private void HandleBagWeight(IEventArgs args)
        {
            if ("BagWeight" == code)
            {
                FreeData fd = (FreeData)args.GetUnit("current");

                if (fd != null)
                {
                    UseCommonAction use = new UseCommonAction();
                    use.key    = "updateBagCapacity";
                    use.values = new List <ArgValue>();
                    use.values.Add(new ArgValue("weight", ((int)Math.Ceiling(BagCapacityUtil.GetWeight(fd))).ToString()));
                    use.values.Add(new ArgValue("capacity", BagCapacityUtil.GetCapacity(fd).ToString()));

                    use.Act(args);
                }
            }
        }
        private void HandleBagWeight(IEventArgs args)
        {
            if ("BagWeight" == code)
            {
                FreeData fd = (FreeData)args.GetUnit("current");

                if (fd != null)
                {
                    SimpleProto sp = FreePool.Allocate();
                    sp.Key = FreeMessageConstant.InventoyUI;
                    sp.Bs.Add(false);
                    sp.Ks.Add(0);
                    sp.Ks.Add(0);

                    sp.Ks.Add((int)BagCapacityUtil.GetCapacity(fd));
                    sp.Ks.Add((int)Math.Ceiling(BagCapacityUtil.GetWeight(fd)));

                    SendMessageAction.sender.SendMessage(args, sp, 1, "current");
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// 更新背包的容量
        /// </summary>
        /// <param name="args"></param>
        private void HandleCapacity(IEventArgs args)
        {
            FreeData fd = (FreeData)args.GetUnit(FreeArgConstant.PlayerCurrent);

            if (fd != null)
            {
                ChickenFuncUtil.UpdateBagCapacity(args, (int)Math.Ceiling(BagCapacityUtil.GetWeight(fd)), BagCapacityUtil.GetCapacity(fd));
            }
        }