Exemplo n.º 1
0
        public bool IsInterrupted(ISkillArgs args)
        {
            FreeData fd = (FreeData)args.GetUnit("current");

            if (fd != null)
            {
                if (PlayerStateUtil.HasPlayerState(EPlayerGameState.InterruptItem, fd.Player.gamePlay))
                {
                    return(true);
                }

                var manager = SingletonManager.Get <StateTransitionConfigManager>();

                foreach (EPlayerState state in fd.Player.StateInteractController().GetCurrStates())
                {
                    StateTransitionConfigItem condition = manager.GetConditionByState(state);
                    if (condition == null)
                    {
                        continue;
                    }
                    if (!condition.GetTransition(Transition.IsUseItem) /*IsUseItem*/)
                    {
                        return(true);
                    }
                }

                return(false);
            }

            return(false);
        }
Exemplo n.º 2
0
        public void ReDraw(ISkillArgs args, ItemInventory inventory, bool includeBack)
        {
            SimpleProto sp = FreePool.Allocate();

            sp.Key = FreeMessageConstant.InventoyUI;
            // 0 重绘,1 添加,2 删除, 3 更新
            sp.Ks.Add(0);
            sp.Bs.Add(true);

            sp.Ks.Add(inventory.posList.Count);

            foreach (ItemPosition ip in inventory.posList)
            {
                FreeItemInfo info = FreeItemConfig.GetItemInfo(ip.GetKey().GetKey());

                sp.Ins.Add(info.cat);
                sp.Ins.Add(info.id);
                sp.Ins.Add(ip.GetCount());

                sp.Ss.Add(inventory.GetName() + "," + ip.GetX() + "," + ip.GetY());
            }

            FreeData fd = (FreeData)args.GetUnit("current");

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

            SendMessageAction.sender.SendMessage(args, sp, 1, "current");

            ChickenFuncUtil.UpdateBagCapacity(args, (int)Math.Ceiling(BagCapacityUtil.GetWeight(fd)), BagCapacityUtil.GetCapacity(fd));
        }
Exemplo n.º 3
0
        public bool IsInterrupted(ISkillArgs args)
        {
            FreeData fd = (FreeData)args.GetUnit("current");

            if (fd != null)
            {
                return(PlayerStateUtil.HasPlayerState(EPlayerGameState.InterruptItem, fd.Player.gamePlay));
            }

            return(false);
        }
Exemplo n.º 4
0
        public void ReDraw(ISkillArgs args, ItemInventory inventory, bool includeBack)
        {
            if (update == null)
            {
                update = new FreeUIUpdateAction();
            }

            update.SetKey(FreeUtil.ReplaceVar(uiKey, args));
            update.ClearValue();

            FreeData fd = (FreeData)args.GetUnit("current");

            FreePrefabValue v = new FreePrefabValue();

            v.SetSeq("1");
            update.AddValue(v);
            v.AddOneValue(new OnePrefabValue(image, ""));
            if (!string.IsNullOrEmpty(name))
            {
                v.AddOneValue(new OnePrefabValue(name, ""));
            }
            if (!string.IsNullOrEmpty(count))
            {
                v.AddOneValue(new OnePrefabValue(count, ""));
            }
            update.SetScope(1);
            update.SetPlayer("current");
            update.Act(args);

            if (inventory.posList.Count > 0)
            {
                ItemPosition ip = inventory.posList[0];
                v.Clear();
                v.AddOneValue(new OnePrefabValue(image, ip.key.GetImg()));
                if (!string.IsNullOrEmpty(name))
                {
                    v.AddOneValue(new OnePrefabValue(name, ip.key.GetName()));
                }
                if (!string.IsNullOrEmpty(count))
                {
                    if (ip.count != 1)
                    {
                        v.AddOneValue(new OnePrefabValue(count, ip.GetCount().ToString()));
                    }
                }
                else
                {
                    v.AddOneValue(new OnePrefabValue(count, ""));
                }
                update.Act(args);

                redrawPart(inventory, args, ip, fd);

                SimpleProto itemInfo = FreePool.Allocate();
                itemInfo.Key = FreeMessageConstant.ItemInfo;
                itemInfo.Ss.Add(inventory.name);
                FreeItemInfo info = FreeItemConfig.GetItemInfo(ip.key.GetKey());
                itemInfo.Ins.Add(info.cat);
                itemInfo.Ins.Add(info.id);
                itemInfo.Ins.Add(ip.GetCount());
                FreeMessageSender.SendMessage(args, "current", itemInfo);
            }
            else
            {
                clearPart(inventory, args, fd);
            }
        }