A basic Scriptable Object representing the item. Stores all data about the item.
상속: ScriptableObject
예제 #1
0
 public bool addItemObjectToInventory(ItemObject _ItemObject)
 {
     ItemObject var_ItemObject = getItemObjectEqual(_ItemObject);
     if(var_ItemObject!=null)
     {
         if (addItemObjectToItemStack(var_ItemObject, _ItemObject))
         {
             if (GameLibrary.Model.Map.World.World.world.getObject(_ItemObject.Id) != null)
             {
                 GameLibrary.Model.Map.World.World.world.removeObjectFromWorld(_ItemObject);
             }
             this.inventoryChanged = true;
             return true;
         }
         else
         {
             //Nehme Item nicht auf usw ....
             return false;
         }
     }
     else
     {
         if (this.isInventoryFull())
         {
             return false;
         }
         else
         {
             this.addItemObjectToInventoryAt(_ItemObject, this.getFreePlace());
             this.inventoryChanged = true;
             return true;
         }
     }
 }
예제 #2
0
 public Item(ItemObject item)
 {
     itemName = item.itemName;
     description = item.description;
     id = item.id;
     spriteTexture = item.spriteTexture;
     moreAbout = item.moreAbout;
 }
예제 #3
0
 public void Add(ItemObject i)
 {
     items.Add(new Item(i));
     //foreach (var item in GameObject.FindObjectsOfType<Portal>())
         //if (item.triggerID == i.id) item.IsTriggered();
     text.gameObject.SetActive(true);
     text.text = "Item "+i.itemName+" adicionado!";
     //text.gameObject.GetComponent<FadeOnAppear>().SendMessageUpwards("OnEnabled");
 }
예제 #4
0
    public void SetItemObj(ItemObject itemObj)
    {
        m_itemObj = itemObj;

        if (m_button != null)
        {
            SetItemDesc();
        }
    }
예제 #5
0
    public void OnClickEvolution(GUIInventorySlot invSlot, GUIInventorySlot.GUIPriceGemButton priceGemButton, YGUISystem.GUIPriceButton button, ItemObject selectedItem)
    {
        if (selectedItem.Item.Evolution < selectedItem.Item.RefItem.maxEvolution)
        {
            if (button.TryToPay())
            {
                invSlot.IconAnimator.SetTrigger("Levelup");
                StartSpinButton(priceGemButton.m_priceButton.GUIImageButton);
                ++selectedItem.Item.Evolution;
                selectedItem.Item.Level = 1;

                switch(selectedItem.Item.RefItem.type)
                {
                case ItemData.Type.Follower:
                    ItemFollowerData itemFollowerData = selectedItem.Item as ItemFollowerData;
                    itemFollowerData.m_follower.EvolutionUp();
                    itemFollowerData.NoApplyOptions(itemFollowerData.m_follower);
                    itemFollowerData.Use(itemFollowerData.m_follower);

                    Const.GetWindowGui(Const.WindowGUIType.EvolutionItemGUI).GetComponent<EvolutionItemGUI>().SetItem(itemFollowerData.m_follower);
                    Const.GetWindowGui(Const.WindowGUIType.EvolutionItemGUI).SetActive(true);
                    break;
                case ItemData.Type.Stat:
                    break;
                case ItemData.Type.Weapon:
                    m_champ.WeaponHolder.EvolutionUp(selectedItem.Item.RefItem.id);
                    selectedItem.Item.NoApplyOptions(m_champ);
                    selectedItem.Item.Use(m_champ);
                    break;
                }

                if (selectedItem.Item.Evolution == selectedItem.Item.RefItem.maxEvolution)
                {
                    priceGemButton.SetPrices(Const.ButtonRole.Nothing, null);
                }

                invSlot.ItemDesc = selectedItem.Item.Description();
                SetButtonRole(Const.ButtonRole.Levelup, invSlot, priceGemButton, selectedItem);

                GPlusPlatform.Instance.AnalyticsTrackEvent("Weapon", "Evolution", selectedItem.Item.RefItem.name + "_Evolution:" + selectedItem.Item.Evolution, 0);
            }
            else
            {
                if (priceGemButton.m_gemButton == button)
                    PopupShop();
            }
        }
    }
예제 #6
0
    public void Init(GameObject tab, ItemObject itemObj)
    {
        m_itemObjOfWarehouse = itemObj;
        m_priceButton0 = new GUIPriceGemButton(transform, "GUIPriceButton0", ()=>{return true;});

        m_evolutionText = new YGUISystem.GUILable(transform.Find("PictureButton/Icon/EvolutionText").gameObject);
        m_item = new YGUISystem.GUIButton(transform.Find("PictureButton").gameObject, m_priceButton0.EnableChecker);
        m_item.Icon.Lable.Text.text = itemObj.Item.Description();
        m_item.Icon.Image = itemObj.ItemIcon;

        m_maxGoldPrice = new YGUISystem.GUIButton(transform.Find("MaxPriceButton").gameObject, m_priceButton0.EnableChecker);
        m_maxGoldPrice.Button.gameObject.SetActive(false);

        m_maxGemPrice = new YGUISystem.GUIButton(transform.Find("MaxGemButton").gameObject, m_priceButton0.EnableChecker);
        m_maxGemPrice.Button.gameObject.SetActive(false);

        m_iconAnimator = transform.Find("PictureButton/Icon").GetComponent<Animator>();
        m_item.Lable.Text.text = RefData.Instance.RefTexts(itemObj.Item.RefItem.desc);
        m_checkImage = tab.transform.Find("Checked").gameObject;
    }
예제 #7
0
    private string GetStatModifiersText(BaseStat stat)
    {
        sb.Length = 0;

        foreach (StatModifier mod in stat.StatModifiers)
        {
            if (sb.Length > 0)
            {
                sb.AppendLine();
            }

            if (mod.Value > 0)
            {
                sb.Append("+");
            }

            if (mod.Type == StatModType.Flat)
            {
                sb.Append(mod.Value);
            }
            else
            {
                sb.Append(mod.Value * 100);
                sb.Append("%");
            }

            ItemObject item = mod.Source as ItemObject;

            if (item != null)
            {
                sb.Append(" ");
                sb.Append(item.ItemName);
            }
            else
            {
                Debug.LogError("Modifier is not an Item!");
            }
        }

        return(sb.ToString());
    }
예제 #8
0
    public override void CreateData()
    {
        CSDefaultData ddata = null;

        bool isNew;

        if (GameConfig.IsMultiMode)
        {
            isNew = MultiColonyManager.Instance.AssignData(ID, CSConst.etppFusion, ref ddata, _ColonyObj);
        }
        else
        {
            isNew = m_Creator.m_DataInst.AssignData(ID, CSConst.etppFusion, ref ddata);
        }

        m_Data = ddata as CSPPFusionData;

        if (isNew)
        {
            Data.m_Name       = CSUtils.GetEntityName(m_Type);
            Data.m_Durability = Info.m_Durability;
            StartWorkingCounter();
        }
        else
        {
            StartRepairCounter(Data.m_CurRepairTime, Data.m_RepairTime, Data.m_RepairValue);
            StartDeleteCounter(Data.m_CurDeleteTime, Data.m_DeleteTime);

            StartWorkingCounter(Data.m_CurWorkedTime, Data.m_WorkedTime);

            // Get Charging Items
            foreach (KeyValuePair <int, int> kvp in Data.m_ChargingItems)
            {
                ItemObject itemObj = ItemMgr.Instance.Get(kvp.Value);
                if (itemObj != null)
                {
                    m_ChargingItems[kvp.Key] = ItemMgr.Instance.Get(kvp.Value).GetCmpt <Energy>();
                }
            }
        }
    }
예제 #9
0
    public override void SpellCast(SpellCaster player)
    {
        // cast spell for free if Umbra's Eclipse is active
        if (SpellTracker.instance.CheckUmbra())
        {
            // get 2 random items
            List <ItemObject> itemsList = GameObject.Find("ItemList").GetComponent <ItemList>().listOfItems;
            ItemObject        item1     = itemsList[Random.Range(0, itemsList.Count)];
            ItemObject        item2     = itemsList[Random.Range(0, itemsList.Count)];

            player.AddToInventory(item1);
            player.AddToInventory(item2);

            PanelHolder.instance.displayNotify("Corpse Taker", "You found " + item1.name + " and " + item2.name + "!", "MainPlayerScene");

            player.numSpellsCastThisTurn++;
            SpellTracker.instance.lastSpellCasted = this;
        }
        else if (player.iMana < iManaCost)
        {
            PanelHolder.instance.displayNotify("Not enough Mana!", "You do not have enough mana to cast this spell.", "OK");
        }
        else
        {
            // subtract mana and glyph costs
            player.iMana -= iManaCost;

            // get 2 random items
            List <ItemObject> itemsList = GameObject.Find("ItemList").GetComponent <ItemList>().listOfItems;
            ItemObject        item1     = itemsList[Random.Range(0, itemsList.Count)];
            ItemObject        item2     = itemsList[Random.Range(0, itemsList.Count)];

            player.AddToInventory(item1);
            player.AddToInventory(item2);

            PanelHolder.instance.displayNotify("Corpse Taker", "You found " + item1.name + " and " + item2.name + "!", "MainPlayerScene");

            player.numSpellsCastThisTurn++;
            SpellTracker.instance.lastSpellCasted = this;
        }
    }
예제 #10
0
        //Module quet XXE
        private static List <ItemObject> scanXXE(string fileName, List <ItemObject> listResult)
        {
            if (listResult == null || listResult.Count == 0)
            {
                listResult = new List <ItemObject>();
            }

            string code = readFile2(fileName);

            CSharpLexer lexer = new CSharpLexer(new AntlrInputStream(code));

            lexer.RemoveErrorListeners();
            CommonTokenStream tokens = new CommonTokenStream(lexer);
            CSharpParser      parser = new CSharpParser(tokens);

            IParseTree         tree     = parser.compilation_unit();
            ParseTreeWalker    walker   = new ParseTreeWalker();
            ExtractClassParser listener = new ExtractClassParser(parser);

            //FindGlobalVariable listener = new FindGlobalVariable(parser);

            walker.Walk(listener, tree);

            if (listener.listXMLContext != null)
            {
                List <ParserRuleContext> listMethod = listener.listXMLContext;
                foreach (var method in listMethod)
                {
                    ParseTreeWalker methodWalker   = new ParseTreeWalker();
                    FindXXEInMethod methodListener = new FindXXEInMethod(parser);
                    methodWalker.Walk(methodListener, method);
                    if (methodListener.isVuln)
                    {
                        ItemObject obj = new ItemObject(methodListener.tmpMethod.BaselineItem, methodListener.tmpMethod.methodName, null, fileName, methodListener.tmpMethod.startLine, "FAIL");
                        listResult.Add(obj);
                    }
                }
            }

            return(listResult);
        }
예제 #11
0
        object GiveKit(PlayerSession session, string kitname)
        {
            Kit kit;

            if (string.IsNullOrEmpty(kitname) || !storedData.Kits.TryGetValue(kitname, out kit))
            {
                return(Msg("MSG_KITNotExist").Replace("{kitname}", kitname));
            }

            var playerinv   = session.WorldPlayerEntity.GetComponent <PlayerInventory>();
            var amanager    = Singleton <AlertManager> .Instance;
            var itemmanager = Singleton <GlobalItemManager> .Instance;

            foreach (var kitem in kit.items)
            {
                if (playerinv.GetSlot(kitem.slot) == null)
                {
                    ItemGeneratorAsset generator = FindItem(kitem.guID.ToString());
                    if (generator == null)
                    {
                        PrintWarning("Something is wrong with the item:" + kitem.guID.ToString());
                        continue;
                    }
                    ItemObject item = itemmanager.CreateItem(generator, kitem.amount);
                    playerinv.SetSlot(kitem.slot, item);
                    amanager.ItemReceivedServer(item, item.StackSize, session.Player);
                    playerinv.Invalidate(false);
                }
                else
                {
                    ItemGeneratorAsset generator = FindItem(kitem.guID.ToString());
                    if (generator == null)
                    {
                        PrintWarning("Something is wrong with the item:" + kitem.guID.ToString());
                        continue;
                    }
                    itemmanager.GiveItem(session.Player, generator, kitem.amount);
                }
            }
            return(true);
        }
예제 #12
0
    public void Attack(InputAction.CallbackContext context)
    {
        if (!context.performed)
        {
            return;
        }
        MeleeComponent wc;
        ItemObject     activeItem = GetActiveItem();

        if (activeItem != null)
        {
            float range = playerRef.interactRange;
            RangeOverrideComponent rc;
            if (rc = activeItem.getComponent("RangeOverrideComponent") as RangeOverrideComponent)
            {
                range = rc.range;
            }
            RaycastHit2D hit;

            var ray = Camera.main.ScreenToWorldPoint(Input.mousePosition);

            if ((Vector2.Distance(playerRef.transform.position, ray) < range) && (hit = Physics2D.Raycast(ray, Vector2.zero)))
            {
                placeUI.playAnimation();
                if ((wc = activeItem.getComponent("MeleeComponent") as MeleeComponent) && hit.transform.CompareTag("Enemy"))
                {
                    EnemyStateMachine enem = hit.transform.gameObject.GetComponent <EnemyStateMachine>();
                    //enem.takeDamage(wc.damage);
                    if (!enem.tokens.ContainsKey("damage"))
                    {
                        enem.tokens.Add("damage", wc.damage);
                    }
                }
                LeftClickable lef;
                if (lef = hit.transform.gameObject.GetComponent <LeftClickable>())
                {
                    EventManager.instance.fireSuccessfulLeftClick(this, activeItem, hit.transform.gameObject.GetInstanceID());
                }
            }
        }
    }
예제 #13
0
        public static MissionWeapon ReadWeaponReferenceFromPacket(
            MBObjectManager objectManager,
            ref bool bufferReadValid)
        {
            if (GameNetworkMessage.ReadBoolFromPacket(ref bufferReadValid))
            {
                return(MissionWeapon.Invalid);
            }
            MBObjectBase mbObjectBase1 = GameNetworkMessage.ReadObjectReferenceFromPacket(objectManager, CompressionBasic.GUIDCompressionInfo, ref bufferReadValid);
            int          num1          = GameNetworkMessage.ReadIntFromPacket(CompressionGeneric.ItemDataValueCompressionInfo, ref bufferReadValid);
            int          num2          = GameNetworkMessage.ReadIntFromPacket(CompressionMission.WeaponReloadPhaseCompressionInfo, ref bufferReadValid);
            short        num3          = (short)GameNetworkMessage.ReadIntFromPacket(CompressionMission.WeaponUsageIndexCompressionInfo, ref bufferReadValid);
            int          num4          = GameNetworkMessage.ReadBoolFromPacket(ref bufferReadValid) ? 1 : 0;
            Banner       banner        = (Banner)null;

            if (num4 != 0)
            {
                string bannerKey = GameNetworkMessage.ReadStringFromPacket(ref bufferReadValid);
                if (bufferReadValid)
                {
                    banner = new Banner(bannerKey);
                }
            }
            ItemObject    primaryItem1 = mbObjectBase1 as ItemObject;
            bool          flag         = GameNetworkMessage.ReadBoolFromPacket(ref bufferReadValid);
            MissionWeapon missionWeapon;

            if (bufferReadValid & flag)
            {
                MBObjectBase mbObjectBase2 = GameNetworkMessage.ReadObjectReferenceFromPacket(objectManager, CompressionBasic.GUIDCompressionInfo, ref bufferReadValid);
                int          num5          = GameNetworkMessage.ReadIntFromPacket(CompressionGeneric.ItemDataValueCompressionInfo, ref bufferReadValid);
                ItemObject   primaryItem2  = mbObjectBase2 as ItemObject;
                missionWeapon = new MissionWeapon(primaryItem1, (ItemModifier)null, banner, (short)num1, (short)num2, new MissionWeapon?(new MissionWeapon(primaryItem2, (ItemModifier)null, banner, (short)num5)));
            }
            else
            {
                missionWeapon = new MissionWeapon(primaryItem1, (ItemModifier)null, banner, (short)num1, (short)num2, new MissionWeapon?());
            }
            missionWeapon.CurrentUsageIndex = (int)num3;
            return(missionWeapon);
        }
예제 #14
0
        public void Import(byte[] buffer)
        {
            PETools.Serialize.Import(buffer, (r) =>
            {
                mIdGenerator.Import(PETools.Serialize.ReadBytes(r));

                int count = r.ReadInt32();

                for (int i = 0; i < count; i++)
                {
                    ItemObject item = ItemObject.Deserialize(PETools.Serialize.ReadBytes(r));

                    Add(item);
                }
                //场景中骨灰盒npcID对应关系的读取
                if (Pathea.ArchiveMgr.Instance.GetCurArvhiveVersion() > Pathea.Archive.Header.Version_2)
                {
                    KillNPC.ashBox_inScene = r.ReadInt32();
                }
            });
        }
        public static bool Prefix(
            ItemObject outputItem,
            Town town,
            Workshop workshop,
            int count,
            bool doNotEffectCapital)
        {
            if (workshop.Owner != Hero.MainHero)
            {
                return(true);
            }

            var stash = MBObjectManager.Instance.GetObject <TownWorkshopStash>(x => x.Town == town);

            if (stash != null && stash.OutputToStash)
            {
                stash.Stash.AddToCounts(outputItem, count);
                return(false);
            }
            return(true);
        }
예제 #16
0
    public bool CanPlaceInSlot(ItemObject _itemObject)
    {
        if (_itemObject == null)
        {
            return(true);
        }
        if (AllowedItems.Length <= 0)
        {
            return(true);
        }

        for (int i = 0; i < AllowedItems.Length; i++)
        {
            if (_itemObject.type == AllowedItems[i])
            {
                //Debug.Log("mozna");
                return(true);
            }
        }
        return(false);
    }
예제 #17
0
        static void AddItemToPlayer(ItemAsset.MaterialItem[] items)
        {
            PlayerPackageCmpt pkg = PeCreature.Instance.mainPlayer.GetCmpt <PlayerPackageCmpt>();

            if (null == pkg)
            {
                return;
            }

            foreach (ItemAsset.MaterialItem item in items)
            {
                pkg.package.Add(item.protoId, item.count);
                //Use default itembox
                ItemObject obj = pkg.package._playerPak.GetItemByProtoID(item.protoId);
                if (null != obj)
                {
                    PeCreature.Instance.mainPlayer.UseItem.Use(obj);
                }
            }
            pkg.package._playerPak.Sort(ItemPackage.ESlotType.Item);
        }
예제 #18
0
    public void AddAccessoryItem(int id)
    {
        ItemObject itemToAdd = database.FetchItemByID(id);

        for (int i = 0; i < generalType; i++)
        {
            if (items[i].ID == -1)
            {
                items[i] = itemToAdd;
                GameObject itemObj = Instantiate(inventoryItem);
                itemObj.GetComponent <ItemData>().item   = itemToAdd;
                itemObj.GetComponent <ItemData>().amount = 1;
                itemObj.GetComponent <ItemData>().slot   = i;
                itemObj.transform.SetParent(slots[i].transform);
                itemObj.transform.position            = Vector2.zero;
                itemObj.GetComponent <Image>().sprite = itemToAdd.Sprite;
                itemObj.name = itemToAdd.Title;
                break;
            }
        }
    }
 public void FillAsMissileBlow(
     ItemObject item,
     WeaponComponentData weaponComponentData,
     int missileIndex,
     sbyte weaponAttachBoneIndex,
     Vec3 startingPosition,
     Vec3 currentPosition,
     Vec3 velocity)
 {
     this._isMissile       = true;
     this.StartingPosition = startingPosition;
     this.CurrentPosition  = currentPosition;
     this.Velocity         = velocity;
     this.ItemFlags        = item.ItemFlags;
     this.WeaponFlags      = weaponComponentData.WeaponFlags;
     this.WeaponClass      = weaponComponentData.WeaponClass;
     this.BoneNoToAttach   = weaponAttachBoneIndex;
     this.AffectorWeaponSlotOrMissileIndex = missileIndex;
     this.Weight           = item.Weight;
     this._isMaterialMetal = weaponComponentData.PhysicsMaterial.Contains("metal");
 }
예제 #20
0
    static bool AddItemToPlayerPkg(int instanceId)
    {
        if (null == pkg)
        {
            return(false);
        }

        if (Pathea.PlayerPackageCmpt.LockStackCount)
        {
            ItemMgr.Instance.DestroyItem(instanceId);
        }

        ItemObject itemObj = ItemMgr.Instance.Get(instanceId);

        if (itemObj == null)
        {
            return(false);
        }

        return(pkg.Add(itemObj));
    }
예제 #21
0
    void RPC_S2C_RemoveItemFromPackage(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        int instanceId = stream.Read <int>();

        //if (null != player)
        //    player.GetItemPackage().RemoveItem(objID);
        ItemObject item = ItemMgr.Instance.Get(instanceId);

        if (item != null)
        {
            Pathea.PlayerPackageCmpt pkg = entity.GetCmpt <Pathea.PlayerPackageCmpt>();
            if (null != pkg)
            {
                pkg.Remove(item);
            }
        }
        if (IsOwner)
        {
            GameUI.Instance.mItemPackageCtrl.ResetItem();
        }
    }
 // call this when crisis arrives (if roundsUntilCrisis == 0)
 public void FinishPlague()
 {
     BoltConsole.Write("Finish Plague, Crisis Solved:  " + crisisSolved);
     if (crisisSolved)
     {
         ItemObject abyssalOre = GameObject.Find("ItemList").GetComponent <ItemList>().listOfItems[1];
         SoundManager.instance.PlaySingle(SoundManager.crisisAverted);
         PanelHolder.instance.displayBoardScan("Plague Averted", "The local apothecaries have gathered special talismans for each wizard for saving them from doing work. " +
                                               "Each wizard will earn a permanent D6 and an Abyssal Ore!", abyssalOre.sprite, "MainPlayerScene");
         player.Spellcaster.dice["D6"] += 1;
         player.Spellcaster.AddToInventory(abyssalOre);
     }
     else
     {
         SoundManager.instance.PlaySingle(SoundManager.crisisLost);
         PanelHolder.instance.displayNotify("Plague Epidemic", "Riddled with disease, all wizards will be unable to cast spells next round. The Swamp will be closed for the next round.", "MainPlayerScene");
         player.Spellcaster.plagueConsequence = true;   // checked in CustomEventHandler.cs and SpellCollectionHandler.cs
         player.Spellcaster.plagueConsTurn    = player.Spellcaster.NumOfTurnsSoFar;
     }
     currentCrisis = "";
 }
예제 #23
0
    // 1: 비어있는 슬롯, 2: 안 비어있는 슬롯.
    void Swap(Unit_Slot xFirst, Unit_Slot oSecond)
    {
        int        Count = oSecond.slot.Count;
        ItemObject item  = oSecond.slot.Peek();

        for (int i = 0; i < Count; i++)
        {
            if (xFirst != null)
            {
                xFirst.slot.Push(item);
            }
        }

        if (xFirst != null)
        {
            xFirst.UpdateInfo(true, oSecond.ItemReturn().DefaultImg);
        }

        oSecond.slot.Clear();
        oSecond.UpdateInfo(false, oSecond.DefaultImg);
    }
예제 #24
0
 public Item(ItemObject item)
 {
     nome                = item.nome;
     uiDisplay           = item.uiDisplay;
     Id                  = item.data.Id;
     type                = item.type;
     potionType          = item.potionType;
     craftingItemType    = item.craftingItemType;
     craftingItemElement = item.craftingItemElement;
     equipmentType       = item.equipmentType;
     marketValue         = item.marketValue;
     craftingDescription = item.craftingDescription;
     buffs               = new ItemBuff[item.data.buffs.Length];
     for (int i = 0; i < buffs.Length; i++)
     {
         buffs[i] = new ItemBuff(item.data.buffs[i].min, item.data.buffs[i].max)
         {
             attribute = item.data.buffs[i].attribute
         };
     }
 }
예제 #25
0
    public void OnEndDrag(PointerEventData eventData)
    {
        GameObject          _inventory           = Global.Obj.GetInventory();
        InventoryController _inventoryController = _inventory.GetComponent <InventoryController>();
        GameObject          _slot           = eventData.pointerDrag.GetComponent <PerentReference>().perent;
        ItemObject          _item           = _slot.GetComponent <ItemCell>().item;
        SlotController      _slotController = _slot.GetComponent <SlotController>();

        if (IsPointerOverUIElement() == false)
        {
            _inventoryController.DropItem(_item, _slotController.GetContainerItemType());
            _slotController.RemoveItem();
        }

        EventSubstitude eventSubstitude = new EventSubstitude();

        eventSubstitude.InvokeDressEvent(_slotController.GetItemType(), false);

        itemSpriteCanvasGroup.blocksRaycasts = true;
        rt.anchoredPosition = originPosition;
    }
예제 #26
0
 public void ResetItemByIdList(List <int> itemIdList)
 {
     if (itemIdList.Count != PakCapacity * (int)ItemPackage.ESlotType.Max)
     {
         Debug.LogErrorFormat("WareHouseObject.ResetItemByIdList() Error: itemIdList.Count !={0},itemIdList.Count:{1}", PakCapacity * (int)ItemPackage.ESlotType.Max, itemIdList.Count);
     }
     ItemPak.Clear();
     if (itemIdList != null)
     {
         for (int i = 0; i < itemIdList.Count; i++)
         {
             ItemObject itemObj = itemIdList[i] == -1 ? null : ItemMgr.Instance.Get(itemIdList[i]);
             if (itemObj != null)
             {
                 //lz-2016.11.16 数据是整个类型的list,这里需要处理分类型
                 ItemPak.PutItem(itemObj, i % PakCapacity, (ItemPackage.ESlotType)(i / PakCapacity));
             }
         }
     }
     GameUI.Instance.mWarehouse.ResetItem();
 }
예제 #27
0
        public void TemplateRepositoryTests_RetrieveTemplateNameList_ShouldRetrieve()
        {
            #region Assemble

            DbHelpers.ClearDatabase();
            TemplateRepository templateRepository = new TemplateRepository(DbHelpers.GetContextFactory());
            ConnectionManager  connectionManager  = new ConnectionManager(@"(local)\SQLExpress", "Odin");
            connectionManager.SetUseTrustedConnection(true);
            LogServiceFactory  logServiceFactory  = new LogServiceFactory("Odin");
            OdinContextFactory OdinContextFactory = new OdinContextFactory(connectionManager, logServiceFactory);
            ItemObject         template2          = new ItemObject(2);
            template2.TemplateId = "CTempalteId";
            ItemObject template = new ItemObject(2);
            template.TemplateId = "ATempalteId";
            ItemObject template3 = new ItemObject(2);
            template3.TemplateId = "BTempalteId";
            ItemObject template4 = new ItemObject(2);
            template4.TemplateId = "DTempalteId";

            #endregion // Assemble

            #region Act

            templateRepository.InsertTemplate(template2);
            templateRepository.InsertTemplate(template);
            templateRepository.InsertTemplate(template3);
            templateRepository.InsertTemplate(template4);
            List <string> results = templateRepository.RetrieveTemplateNameList();
            #endregion // Act

            #region Assert

            Assert.AreEqual(results[0], "ATempalteId");
            Assert.AreEqual(results[1], "BTempalteId");
            Assert.AreEqual(results[2], "CTempalteId");
            Assert.AreEqual(results[3], "DTempalteId");


            #endregion // Assert
        }
예제 #28
0
        /// <summary>
        /// Lấy pager sản phẩm
        /// </summary>
        private PagerInfoModel <ItemObject> GetPagerItems(FilterDataModel inputObject)
        {
            // Khởi tạo biến cục bộ
            var pagerResult    = new PagerInfoModel <ItemObject>();
            var listData       = new List <ItemObject>();
            var processDao     = new ItemsListDao();
            var storageFileCom = new StorageFileCom();

            // Lấy thông tin danh sách sản phẩm
            var pagerItems = processDao.GetPagerItems(inputObject);

            // Khai báo biến dùng trong loop
            ItemObject info = null;

            // Duyệt danh sách sản phẩm mới
            foreach (var item in pagerItems.ListData)
            {
                // Khởi tạo đối tượng sản phẩm mới
                info = new ItemObject();

                // Gán giá trị vào đối tượng sản phẩm mới
                info.ItemCd         = item.ItemCd;
                info.ItemName       = item.ItemName;
                info.ItemSearchName = item.ItemSearchName;
                info.ItemImage      = storageFileCom.GetFileName(
                    Logics.LOCALE_DEFAULT,
                    item.FileCd,
                    false);

                // Thêm vào đối tượng kết quả
                listData.Add(info);
            }

            // Gán giá trị trả về
            pagerResult.ListData = listData;
            pagerResult.Total    = pagerItems.Total;

            // Kết quả trả về
            return(pagerResult);
        }
예제 #29
0
        /// <summary>
        /// Place picked item to the backpack holder position for this item type
        /// </summary>
        /// <param name="item">picked item</param>
        /// <param name="instantly">if false - then item will be pushed to backpack with animation</param>
        private void PlaceItemToHolder(ItemObject item, bool instantly = true)
        {
            for (var i = 0; i < _holders.Length; i++)
            {
                if (_holders[i].ItemType != item.ItemType)
                {
                    continue;
                }

                item.SetState(ItemState.InBackpack);
                item.transform.SetParent(_holders[i].Container);

                if (instantly)
                {
                    item.transform.localPosition = Vector3.zero;
                    item.transform.localRotation = Quaternion.identity;
                    return;
                }

                item.StartTween();
            }
        }
예제 #30
0
    void RPC_S2C_PublicStorageIndex(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        int tab = stream.Read <int>();

        int[] itemIDs = stream.Read <int[]>();

        SlotList itemList = GroupNetwork.GetSlotList((ItemPackage.ESlotType)tab);

        for (int i = 0; i < itemIDs.Length; i++)
        {
            if (-1 == itemIDs[i])
            {
                itemList[i] = null;
                continue;
            }

            ItemObject item = ItemMgr.Instance.Get(itemIDs[i]);
            itemList[i] = item;
        }

        //GameGui_N.Instance.mPublicInventoryGui.SetItempackage(GroupNetwork._Items);
    }
예제 #31
0
    void RPC_S2C_PersonalStorageSplit(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        int objID    = stream.Read <int>();
        int dstIndex = stream.Read <int>();

        ItemObject item = ItemMgr.Instance.Get(objID);

        if (null == item)
        {
            return;
        }

        NpcStorage storage = NpcStorageMgr.GetStorage(Id);

        if (null == storage)
        {
            return;
        }

        storage.Package.PutItem(item, dstIndex);
        storage.Reset();
    }
 static void Postfix(CraftingCampaignBehavior __instance, ItemObject item)
 {
     if (item == null)
     {
         return;
     }
     if (__instance == null)
     {
         throw new ArgumentNullException(nameof(__instance), $"Tried to run postfix for {nameof(CraftingCampaignBehavior)}.DoSmelting but the instance was null.");
     }
     if (openPartMethodInfo == null)
     {
         GetMethodInfo();
     }
     foreach (CraftingPiece piece in SmeltingHelper.GetNewPartsFromSmelting(item))
     {
         if (piece != null && piece.Name != null)
         {
             openPartMethodInfo.Invoke(__instance, new object[] { piece });
         }
     }
 }
예제 #33
0
    public bool IsChargeable(ItemObject itemObj)
    {
        if (null == itemObj)
        {
            return(false);
        }

        ItemAsset.Energy energy = itemObj.GetCmpt <ItemAsset.Energy>();

        if (null == energy || itemObj.protoData.unchargeable)
        {
            if (m_bUseMsgBox)
            {
                //lz-2016.10.24 把对话框的提示改成左上角提示
                PeTipMsg.Register(PELocalization.GetString(8000094), PeTipMsg.EMsgLevel.Error);
            }
            else
            {
                CSUI_MainWndCtrl.ShowStatusBar(PELocalization.GetString(8000094), Color.red);
            }
            return(false);
        }

        if ((!(energy is ItemAsset.EnergySmall)) && !m_bCanChargeLargedItem)
        {
            if (m_bUseMsgBox)
            {
                //lz-2016.10.24 把对话框的提示改成左上角提示
                PeTipMsg.Register(PELocalization.GetString(8000095), PeTipMsg.EMsgLevel.Warning);
            }
            else
            {
                CSUI_MainWndCtrl.ShowStatusBar(PELocalization.GetString(8000095), Color.red);
            }
            return(false);
        }

        return(true);
    }
 public override void OnAgentHit(Agent affectedAgent, Agent affectorAgent, int damage, int weaponKind, int currentWeaponUsageIndex)
 {
     base.OnAgentHit(affectedAgent, affectorAgent, damage, weaponKind, currentWeaponUsageIndex);
     if (affectedAgent.IsMainAgent || affectedAgent.RiderAgent?.IsMainAgent == true)
     {
         ShoulderCamPatch.ShakeCamera(
             SubModule.Config.MinimumPlayerHitCamShake + damage * SubModule.Config.PlayerHitCamShakeMultiplier,
             SubModule.Config.PlayerHitCamShakeDuration
             );
     }
     else if (affectorAgent.IsMainAgent || affectorAgent.RiderAgent?.IsMainAgent == true)
     {
         var weapon = ItemObject.GetItemFromWeaponKind(weaponKind);
         if (weapon != null && MeleeWeaponTypes.Contains(weapon.Type))
         {
             ShoulderCamPatch.ShakeCamera(
                 SubModule.Config.MinimumEnemyHitCamShakeAmount + damage * SubModule.Config.EnemyHitCamShakeMultiplier,
                 SubModule.Config.EnemyHitCamShakeDuration
                 );
         }
     }
 }
    public void AddItem(int Amount, ItemObject NewItem)//add to free space in inventory
    {
        List <InventorySlot> MachItems = Inventory.FindAll(x => x.Item.name.Equals(NewItem.name));

        if (MachItems.Count == 0 || MachItems.TrueForAll(x => x.Amount >= maxInSlot))
        {
            //  Debug.Log(MachItems.Count);
            InventorySlot newSlot = new InventorySlot(Amount, NewItem);
            Inventory.Add(newSlot);
        }
        else
        {
            try
            {
                MachItems.Find(x => x.Amount < maxInSlot).AddItem(NewItem, Amount);
            }
            catch (ArgumentException)
            {
                Debug.Log("something went wrong");
            }
        }
    }
예제 #36
0
파일: Room.cs 프로젝트: jonike/CubeRoom
    public void PlaceItem(ItemObject item)
    {
        items.Add(item);

        if (item.Item.IsOccupid)
        {
            int  minX, maxX, minY, maxY, minZ, maxZ;
            bool success = ItemXYZ(item.Item, out minX, out maxX, out minY, out maxY, out minZ, out maxZ);
            if (!success)
            {
                return;
            }

            for (int x = minX; x < maxX; x++)
            {
                for (int y = minY; y < maxY; y++)
                {
                    for (int z = minZ; z < maxZ; z++)
                    {
                        // string coordinate = x + ", " + y + ", " + z;
                        // Debug.Log(coordinate);
                        int key = x * Size.y * Size.z + y * Size.z + z;
                        if (!space.ContainsKey(key))
                        {
                            space.Add(key, new List <ItemObject>());
                        }

                        if (space[key].Count > 0)
                        {
                            string coordinate = x + ", " + y + ", " + z;
                            Debug.LogWarning(coordinate + " has already been occupied");
                        }

                        space[key].Add(item);
                    }
                }
            }
        }
    }
예제 #37
0
 public void OnClickLevelupToMax(GUIInventorySlot invSlot, GUIInventorySlot.GUIPriceGemButton priceGemButton, bool gem, ItemObject selectedItem)
 {
     invSlot.MaxGemButton.Button.gameObject.SetActive(false);
     invSlot.MaxPriceButton.Button.gameObject.SetActive(false);
     StartCoroutine(DelayClickLevelUp(invSlot, priceGemButton, gem, selectedItem));
 }
예제 #38
0
    public void OnClickUnlock(GUIInventorySlot invSlot, GUIInventorySlot.GUIPriceGemButton priceGemButton, YGUISystem.GUIPriceButton button, ItemObject selectedItem)
    {
        if (selectedItem.Item.Lock == true)
        {
            if (button.TryToPay() == true)
            {
                invSlot.IconAnimator.SetTrigger("Levelup");

                selectedItem.Item.Lock = false;
                selectedItem.Item.Level = 1;

                invSlot.ItemDesc = selectedItem.Item.Description();

                SetButtonRole(Const.ButtonRole.Levelup, invSlot, priceGemButton, selectedItem);
                switch(selectedItem.Item.RefItem.type)
                {
                case ItemData.Type.Follower:
                    selectedItem.Item.Equip(m_champ);
                    break;
                case ItemData.Type.Stat:
                    selectedItem.Item.Equip(m_champ);
                    break;
                case ItemData.Type.Weapon:
                    selectedItem.Item.Equip(m_champ);
                    break;
                }
            }
            else
            {
                if (priceGemButton.m_gemButton == button)
                    PopupShop();
            }
        }
    }
예제 #39
0
    protected void initInven(Dictionary<ItemData.Type, List<ItemObject>> items)
    {
        items.Clear();
        foreach (ItemData.Type type in System.Enum.GetValues(typeof(ItemData.Type)))
        {
            if (type == ItemData.Type.Count)
                continue;

            items.Add(type, new List<ItemObject>());
        }

        m_gold = new ItemObject(new ItemGoldData(0));
        m_goldMedal = new ItemObject(new ItemGoldMedalData(0));
        m_gem = new ItemObject(new ItemGemData(0));
        m_alienEssence = new ItemObject(new ItemAlienEssenceData(0));
    }
예제 #40
0
 public ItemObject getItemObjectEqual(ItemObject _ItemObject)
 {
     foreach (ItemObject var_ItemObject in this.items)
     {
         if (var_ItemObject.ItemEnum == _ItemObject.ItemEnum)
         {
             if (var_ItemObject.OnStack + _ItemObject.OnStack < var_ItemObject.StackMax)
             {
                 return var_ItemObject;
             }
         }
     }
     return null;
 }
예제 #41
0
 public void dropItem(CreatureObject _InventoryOwner, ItemObject _ItemObject)
 {
     this.items.Remove(_ItemObject);
     this.InventoryChanged = true;
     if (Configuration.Configuration.isHost)
     {
     }
     else
     {
         Configuration.Configuration.networkManager.addEvent(new GameLibrary.Connection.Message.CreatureInventoryItemPositionChangeMessage(_InventoryOwner.Id, _ItemObject.PositionInInventory, -1), GameMessageImportance.VeryImportant);
     }
 }
예제 #42
0
        //Sendet Änderung zum clienten bzw. server.
        public void changeItemPosition(CreatureObject _InventoryOwner, ItemObject _ItemObject, int _NewPosition)
        {
            int var_OldPosition = _ItemObject.PositionInInventory;
            _ItemObject.PositionInInventory = _NewPosition;
            if (var_OldPosition == _NewPosition)
            {

            }
            else
            {
                //Sende jeweilige Änderung
                if (Configuration.Configuration.isHost)
                {

                }
                else
                {
                    Configuration.Configuration.networkManager.addEvent(new GameLibrary.Connection.Message.CreatureInventoryItemPositionChangeMessage(_InventoryOwner.Id, var_OldPosition, _NewPosition), GameMessageImportance.VeryImportant);
                }
            }
        }
        /// <summary>
        /// Container Class for all the properties for organization.
        /// </summary>
        /// <param name="c"></param>
        public TorqueScriptTemplate(ref dnTorque c)
            {
            m_ts = c;
            _mConsoleobject = new ConsoleObject(ref c);
            _mMathobject = new tMath(ref c);
            	_mUtil = new UtilObject(ref c);
	_mHTTPObject = new HTTPObjectObject(ref c);
	_mTCPObject = new TCPObjectObject(ref c);
	_mDynamicConsoleMethodComponent = new DynamicConsoleMethodComponentObject(ref c);
	_mSimComponent = new SimComponentObject(ref c);
	_mArrayObject = new ArrayObjectObject(ref c);
	_mConsoleLogger = new ConsoleLoggerObject(ref c);
	_mFieldBrushObject = new FieldBrushObjectObject(ref c);
	_mPersistenceManager = new PersistenceManagerObject(ref c);
	_mSimDataBlock = new SimDataBlockObject(ref c);
	_mSimObject = new SimObjectObject(ref c);
	_mSimPersistSet = new SimPersistSetObject(ref c);
	_mSimSet = new SimSetObject(ref c);
	_mSimXMLDocument = new SimXMLDocumentObject(ref c);
	_mFileObject = new FileObjectObject(ref c);
	_mFileStreamObject = new FileStreamObjectObject(ref c);
	_mStreamObject = new StreamObjectObject(ref c);
	_mZipObject = new ZipObjectObject(ref c);
	_mDecalRoad = new DecalRoadObject(ref c);
	_mMeshRoad = new MeshRoadObject(ref c);
	_mRiver = new RiverObject(ref c);
	_mScatterSky = new ScatterSkyObject(ref c);
	_mSkyBox = new SkyBoxObject(ref c);
	_mSun = new SunObject(ref c);
	_mGuiRoadEditorCtrl = new GuiRoadEditorCtrlObject(ref c);
	_mForest = new ForestObject(ref c);
	_mForestWindEmitter = new ForestWindEmitterObject(ref c);
	_mForestBrush = new ForestBrushObject(ref c);
	_mForestBrushTool = new ForestBrushToolObject(ref c);
	_mForestEditorCtrl = new ForestEditorCtrlObject(ref c);
	_mForestSelectionTool = new ForestSelectionToolObject(ref c);
	_mCubemapData = new CubemapDataObject(ref c);
	_mDebugDrawer = new DebugDrawerObject(ref c);
	_mGuiTSCtrl = new GuiTSCtrlObject(ref c);
	_mGuiBitmapButtonCtrl = new GuiBitmapButtonCtrlObject(ref c);
	_mGuiButtonBaseCtrl = new GuiButtonBaseCtrlObject(ref c);
	_mGuiCheckBoxCtrl = new GuiCheckBoxCtrlObject(ref c);
	_mGuiIconButtonCtrl = new GuiIconButtonCtrlObject(ref c);
	_mGuiSwatchButtonCtrl = new GuiSwatchButtonCtrlObject(ref c);
	_mGuiToolboxButtonCtrl = new GuiToolboxButtonCtrlObject(ref c);
	_mGuiAutoScrollCtrl = new GuiAutoScrollCtrlObject(ref c);
	_mGuiDynamicCtrlArrayControl = new GuiDynamicCtrlArrayControlObject(ref c);
	_mGuiFormCtrl = new GuiFormCtrlObject(ref c);
	_mGuiFrameSetCtrl = new GuiFrameSetCtrlObject(ref c);
	_mGuiPaneControl = new GuiPaneControlObject(ref c);
	_mGuiRolloutCtrl = new GuiRolloutCtrlObject(ref c);
	_mGuiScrollCtrl = new GuiScrollCtrlObject(ref c);
	_mGuiStackControl = new GuiStackControlObject(ref c);
	_mGuiTabBookCtrl = new GuiTabBookCtrlObject(ref c);
	_mGuiBitmapCtrl = new GuiBitmapCtrlObject(ref c);
	_mGuiColorPickerCtrl = new GuiColorPickerCtrlObject(ref c);
	_mGuiDirectoryFileListCtrl = new GuiDirectoryFileListCtrlObject(ref c);
	_mGuiFileTreeCtrl = new GuiFileTreeCtrlObject(ref c);
	_mGuiGameListMenuCtrl = new GuiGameListMenuCtrlObject(ref c);
	_mGuiGameListOptionsCtrl = new GuiGameListOptionsCtrlObject(ref c);
	_mGuiGradientCtrl = new GuiGradientCtrlObject(ref c);
	_mGuiListBoxCtrl = new GuiListBoxCtrlObject(ref c);
	_mGuiMaterialCtrl = new GuiMaterialCtrlObject(ref c);
	_mGuiMLTextCtrl = new GuiMLTextCtrlObject(ref c);
	_mGuiPopUpMenuCtrl = new GuiPopUpMenuCtrlObject(ref c);
	_mGuiPopUpMenuCtrlEx = new GuiPopUpMenuCtrlExObject(ref c);
	_mGuiSliderCtrl = new GuiSliderCtrlObject(ref c);
	_mGuiTabPageCtrl = new GuiTabPageCtrlObject(ref c);
	_mGuiTextCtrl = new GuiTextCtrlObject(ref c);
	_mGuiTextEditCtrl = new GuiTextEditCtrlObject(ref c);
	_mGuiTextListCtrl = new GuiTextListCtrlObject(ref c);
	_mGuiTreeViewCtrl = new GuiTreeViewCtrlObject(ref c);
	_mGuiCanvas = new GuiCanvasObject(ref c);
	_mGuiControl = new GuiControlObject(ref c);
	_mGuiControlProfile = new GuiControlProfileObject(ref c);
	_mDbgFileView = new DbgFileViewObject(ref c);
	_mGuiEditCtrl = new GuiEditCtrlObject(ref c);
	_mGuiFilterCtrl = new GuiFilterCtrlObject(ref c);
	_mGuiGraphCtrl = new GuiGraphCtrlObject(ref c);
	_mGuiImageList = new GuiImageListObject(ref c);
	_mGuiInspector = new GuiInspectorObject(ref c);
	_mGuiInspectorTypeFileName = new GuiInspectorTypeFileNameObject(ref c);
	_mGuiInspectorTypeBitMask32 = new GuiInspectorTypeBitMask32Object(ref c);
	_mGuiMenuBar = new GuiMenuBarObject(ref c);
	_mGuiParticleGraphCtrl = new GuiParticleGraphCtrlObject(ref c);
	_mGuiShapeEdPreview = new GuiShapeEdPreviewObject(ref c);
	_mGuiInspectorDynamicField = new GuiInspectorDynamicFieldObject(ref c);
	_mGuiInspectorDynamicGroup = new GuiInspectorDynamicGroupObject(ref c);
	_mGuiInspectorField = new GuiInspectorFieldObject(ref c);
	_mGuiVariableInspector = new GuiVariableInspectorObject(ref c);
	_mGuiMessageVectorCtrl = new GuiMessageVectorCtrlObject(ref c);
	_mGuiProgressBitmapCtrl = new GuiProgressBitmapCtrlObject(ref c);
	_mGuiTickCtrl = new GuiTickCtrlObject(ref c);
	_mGuiTheoraCtrl = new GuiTheoraCtrlObject(ref c);
	_mMessageVector = new MessageVectorObject(ref c);
	_mEditTSCtrl = new EditTSCtrlObject(ref c);
	_mGuiMissionAreaCtrl = new GuiMissionAreaCtrlObject(ref c);
	_mMECreateUndoAction = new MECreateUndoActionObject(ref c);
	_mMEDeleteUndoAction = new MEDeleteUndoActionObject(ref c);
	_mWorldEditor = new WorldEditorObject(ref c);
	_mLangTable = new LangTableObject(ref c);
	_mPathedInterior = new PathedInteriorObject(ref c);
	_mMaterial = new MaterialObject(ref c);
	_mSimResponseCurve = new SimResponseCurveObject(ref c);
	_mMenuBar = new MenuBarObject(ref c);
	_mPopupMenu = new PopupMenuObject(ref c);
	_mFileDialog = new FileDialogObject(ref c);
	_mPostEffect = new PostEffectObject(ref c);
	_mRenderBinManager = new RenderBinManagerObject(ref c);
	_mRenderPassManager = new RenderPassManagerObject(ref c);
	_mRenderPassStateToken = new RenderPassStateTokenObject(ref c);
	_mSceneObject = new SceneObjectObject(ref c);
	_mSFXController = new SFXControllerObject(ref c);
	_mSFXParameter = new SFXParameterObject(ref c);
	_mSFXProfile = new SFXProfileObject(ref c);
	_mSFXSource = new SFXSourceObject(ref c);
	_mActionMap = new ActionMapObject(ref c);
	_mNetConnection = new NetConnectionObject(ref c);
	_mNetObject = new NetObjectObject(ref c);
	_mAIClient = new AIClientObject(ref c);
	_mAIConnection = new AIConnectionObject(ref c);
	_mAIPlayer = new AIPlayerObject(ref c);
	_mCamera = new CameraObject(ref c);
	_mDebris = new DebrisObject(ref c);
	_mGroundPlane = new GroundPlaneObject(ref c);
	_mGuiMaterialPreview = new GuiMaterialPreviewObject(ref c);
	_mGuiObjectView = new GuiObjectViewObject(ref c);
	_mItem = new ItemObject(ref c);
	_mLightBase = new LightBaseObject(ref c);
	_mLightDescription = new LightDescriptionObject(ref c);
	_mLightFlareData = new LightFlareDataObject(ref c);
	_mMissionArea = new MissionAreaObject(ref c);
	_mSpawnSphere = new SpawnSphereObject(ref c);
	_mPathCamera = new PathCameraObject(ref c);
	_mPhysicalZone = new PhysicalZoneObject(ref c);
	_mPlayer = new PlayerObject(ref c);
	_mPortal = new PortalObject(ref c);
	_mProjectile = new ProjectileObject(ref c);
	_mProximityMine = new ProximityMineObject(ref c);
	_mShapeBaseData = new ShapeBaseDataObject(ref c);
	_mShapeBase = new ShapeBaseObject(ref c);
	_mStaticShape = new StaticShapeObject(ref c);
	_mTrigger = new TriggerObject(ref c);
	_mTSStatic = new TSStaticObject(ref c);
	_mZone = new ZoneObject(ref c);
	_mRenderMeshExample = new RenderMeshExampleObject(ref c);
	_mLightning = new LightningObject(ref c);
	_mParticleData = new ParticleDataObject(ref c);
	_mParticleEmitterData = new ParticleEmitterDataObject(ref c);
	_mParticleEmitterNode = new ParticleEmitterNodeObject(ref c);
	_mPrecipitation = new PrecipitationObject(ref c);
	_mGameBase = new GameBaseObject(ref c);
	_mGameConnection = new GameConnectionObject(ref c);
	_mPhysicsDebrisData = new PhysicsDebrisDataObject(ref c);
	_mPhysicsForce = new PhysicsForceObject(ref c);
	_mPhysicsShape = new PhysicsShapeObject(ref c);
	_mAITurretShape = new AITurretShapeObject(ref c);
	_mTurretShape = new TurretShapeObject(ref c);
	_mFlyingVehicle = new FlyingVehicleObject(ref c);
	_mWheeledVehicle = new WheeledVehicleObject(ref c);
	_mTerrainBlock = new TerrainBlockObject(ref c);
	_mSettings = new SettingsObject(ref c);
	_mCompoundUndoAction = new CompoundUndoActionObject(ref c);
	_mUndoManager = new UndoManagerObject(ref c);
	_mUndoAction = new UndoActionObject(ref c);
	_mEventManager = new EventManagerObject(ref c);
	_mMessage = new MessageObject(ref c);
}
예제 #44
0
    void assignSkillButton(int slot, ItemObject itemObj, System.Func<bool> doFunctor)
    {
        m_specialButtons[slot] = new YGUISystem.GUIChargeButton(transform.Find("Special/Button"+slot).gameObject, ()=>{
            if (m_specialButtons[slot].MaxChargingPoint != itemObj.Item.Level)
            {
                m_specialButtons[slot].MaxChargingPoint = itemObj.Item.Level;
                m_specialButtons[slot].ChargingPoint++;
            }

            if (m_champ.SkillStacks[itemObj.Item.RefItem.id-21] > 0)
            {
                m_specialButtons[slot].ChargingPoint++;
                m_champ.SkillStacks[itemObj.Item.RefItem.id-21] = 0;
            }
            return itemObj.Item.Level > 0 || m_specialButtons[slot].ChargingPoint > 0;
        });

        m_specialButtons[slot].Icon.Image = itemObj.ItemIcon;
        m_specialButtons[slot].DoFunctor = doFunctor;
        m_specialButtons[slot].CoolDownTime = itemObj.Item.RefItem.weaponStat.coolTime;
    }
예제 #45
0
    public void PullItem(ItemObject itemObj, int count)
    {
        if (itemObj == null)
        {
            return;
        }

        if (count <= itemObj.Item.Count)
        {
            itemObj.Item.Count -= count;
            if (itemObj.Item.Count == 0)
            {
                //RemoveItem(itemObj);
            }
        }
    }
예제 #46
0
 public bool addItemObjectToInventoryAt(ItemObject _ItemObject, int _Position)
 {
     if (!this.isInventoryFull())
     {
         _ItemObject.PositionInInventory = _Position;
         this.items.Add(_ItemObject);
         if (GameLibrary.Model.Map.World.World.world.getObject(_ItemObject.Id) != null)
         {
             GameLibrary.Model.Map.World.World.world.removeObjectFromWorld(_ItemObject);
         }
         return true;
     }
     return false;
 }
예제 #47
0
    public bool OnClickLevelup(GUIInventorySlot invSlot, GUIInventorySlot.GUIPriceGemButton priceGemButton, bool gem, ItemObject selectedItem, bool visableMaxButton)
    {
        if (m_champ == null)
            return false;

        if (selectedItem.Item.Level == selectedItem.Item.RefItem.maxLevel)
            return false;

        YGUISystem.GUIPriceButton button = gem == true ? priceGemButton.m_gemButton : priceGemButton.m_priceButton;

        if (button.TryToPay())
        {
            invSlot.IconAnimator.SetTrigger("Levelup");
            StartSpinButton(priceGemButton.m_priceButton.GUIImageButton);
            ++selectedItem.Item.Level;

            if (selectedItem.Item.RefItem.type == ItemData.Type.Weapon)
            {
                m_champ.WeaponHolder.LevelUp(selectedItem.Item.RefItem.id);
                selectedItem.Item.Use(m_champ);
            }
            else if (selectedItem.Item.RefItem.type == ItemData.Type.Follower)
            {
                ItemFollowerData itemFollowerData = selectedItem.Item as ItemFollowerData;
                itemFollowerData.m_follower.LevelUp();
                itemFollowerData.Use(itemFollowerData.m_follower);
            }
            else if (selectedItem.Item.RefItem.type == ItemData.Type.Stat
                     || selectedItem.Item.RefItem.type == ItemData.Type.WeaponParts)
            {
                selectedItem.Item.Use(m_champ);
            }

            if (selectedItem.Item.Level == selectedItem.Item.RefItem.maxLevel)
            {
                priceGemButton.SetPrices(Const.ButtonRole.Nothing, null);
                SetButtonRole(Const.ButtonRole.Evolution, invSlot, priceGemButton, selectedItem);
            }

            invSlot.ItemDesc = selectedItem.Item.Description();

            if (visableMaxButton == true)
            {
                invSlot.MaxGemButton.Lable.Text.text = RefData.Instance.RefTexts(MultiLang.ID.KeepLevelup);
                invSlot.MaxPriceButton.Lable.Text.text = RefData.Instance.RefTexts(MultiLang.ID.KeepLevelup);
                if (gem == true)
                    invSlot.MaxGemButton.Button.gameObject.SetActive(Const.CheckAvailableItem(selectedItem.Item.RefItem.levelup.else_conds, Const.GetItemLevelupWorth(selectedItem.Item.Level, selectedItem.Item.RefItem.levelup)));
                else
                    invSlot.MaxPriceButton.Button.gameObject.SetActive(Const.CheckAvailableItem(selectedItem.Item.RefItem.levelup.conds, Const.GetItemLevelupWorth(selectedItem.Item.Level, selectedItem.Item.RefItem.levelup)));
            }

            GPlusPlatform.Instance.AnalyticsTrackEvent("Weapon", "Levelup", selectedItem.Item.RefItem.name + "_Lv:" + selectedItem.Item.Level, 0);
            return true;
        }
        else
        {
            if (priceGemButton.m_gemButton == button)
                PopupShop();
        }

        if (gem == true)
            invSlot.MaxGemButton.Button.gameObject.SetActive(false);
        else
            invSlot.MaxPriceButton.Button.gameObject.SetActive(false);

        return false;
    }
예제 #48
0
 public void PushItem(ItemData item)
 {
     ItemObject itemObj = FindItem(item.RefItem.id);
     if (itemObj == null)
     {
         ItemObject newItemObj = new ItemObject(item);
         m_warehouseData.m_items[item.RefItem.type].Add(newItemObj);
         if (item.RefItem.type == ItemData.Type.WeaponDNA)
             m_weaponDNA = newItemObj;
     }
     else
     {
         itemObj.Item.Count += item.Count;
     }
 }
예제 #49
0
        public void itemDropedInInventory(CreatureObject _InventoryOwner, ItemObject _ItemObject, int _NewPosition)
        {
            if (this.items.Contains(_ItemObject))
            {
                this.changeItemPosition(_InventoryOwner, _ItemObject, _NewPosition);
            }
            else
            {
                //TODO: Kommt wohl von wo anders... anderes Inventar usw..
                //this.addItemObjectToInventory(_ItemObject);
                /*if (_InventoryOwner.Equipment.Contains(_ItemObject))
                {
                    //Sende jeweilige Änderung
                    if (Configuration.Configuration.isHost)
                    {

                    }
                    else
                    {
                        Event.EventList.Add(new Event(new GameLibrary.Connection.Message.CreatureEquipmentToInventoryMessage(_InventoryOwner.Id, _ItemObject.PositionInInventory, _NewPosition), GameMessageImportance.VeryImportant));
                    }
                    //_InventoryOwner.Equipment.Remove((EquipmentObject)_ItemObject);
                    //this.addItemObjectToInventory(_ItemObject);
                }*/
                if (_ItemObject is EquipmentObject)
                {
                    if (_InventoryOwner.Body.containsEquipmentObject((EquipmentObject)_ItemObject))
                    {
                        Configuration.Configuration.networkManager.addEvent(new GameLibrary.Connection.Message.CreatureEquipmentToInventoryMessage(_InventoryOwner.Id, _ItemObject.PositionInInventory, _NewPosition), GameMessageImportance.VeryImportant);
                    }
                    else
                    {
                        //_InventoryOwner enthält das Equip nicht im Body. Kommt woanders her!
                    }
                }
            }
        }
예제 #50
0
    void SetButtonRole(Const.ButtonRole role, GUIInventorySlot invSlot, GUIInventorySlot.GUIPriceGemButton priceGemButton, ItemObject item)
    {
        priceGemButton.RemoveAllListeners();

        switch(role)
        {
        case Const.ButtonRole.Levelup:
            {

                priceGemButton.EnableChecker = ()=>{
                    return item.Item.RefItem.levelup != null && item.Item.Lock == false && item.Item.Level < item.Item.RefItem.maxLevel;
                };

            invSlot.SetListener(() => OnClickLevelupToMax(invSlot, priceGemButton, false, item), () => OnClickLevelupToMax(invSlot, priceGemButton, true, item) );
                priceGemButton.SetPrices(role, item.Item.RefItem);

            priceGemButton.AddListener(() => OnClickLevelup(invSlot, priceGemButton, false, item, true), () => OnClickLevelup(invSlot, priceGemButton, true, item, true) );
            priceGemButton.SetLable(RefData.Instance.RefTexts(MultiLang.ID.LevelUp));
            }
            break;

        case Const.ButtonRole.Unlock:
            {
            priceGemButton.EnableChecker = ()=>{

                return item.Item.RefItem.unlock != null && item.Item.Lock == true;
            };

                priceGemButton.SetPrices(role, item.Item.RefItem);

                priceGemButton.AddListener(() => OnClickUnlock(invSlot, priceGemButton, priceGemButton.m_priceButton, item), () => OnClickUnlock(invSlot, priceGemButton, priceGemButton.m_gemButton, item) );
                priceGemButton.SetLable(RefData.Instance.RefTexts(MultiLang.ID.Unlock));

            }
            break;

        case Const.ButtonRole.Evolution:
            {
            priceGemButton.EnableChecker = ()=>{
                return item.Item.RefItem.evolution != null && item.Item.Level == item.Item.RefItem.maxLevel && item.Item.Evolution < item.Item.RefItem.maxEvolution;
            };

            priceGemButton.SetPrices(role, item.Item.RefItem);

            priceGemButton.AddListener(() => OnClickEvolution(invSlot, priceGemButton, priceGemButton.m_priceButton, item), () => OnClickEvolution(invSlot, priceGemButton, priceGemButton.m_gemButton, item) );
            priceGemButton.SetLable(RefData.Instance.RefTexts(MultiLang.ID.Evolution));
            }
            break;

        default:
            {
            }
            break;
        }
    }
예제 #51
0
 private bool addItemObjectToItemStack(ItemObject _ItemObject, ItemObject _AddItemObject)
 {
     if (_ItemObject.OnStack < _ItemObject.StackMax + _AddItemObject.OnStack)
     {
         _ItemObject.OnStack += _AddItemObject.OnStack;
         return true;
     }
     else
     {
         return false;
     }
 }
예제 #52
0
 private bool removeItemObjectFromItemStack(ItemObject _ItemObject)
 {
     _ItemObject.OnStack -= 1;
     if (_ItemObject.OnStack <= 0)
     {
         this.items.Remove(_ItemObject);
     }
     return true;
 }
예제 #53
0
    public void Deserialize(byte[] data)
    {
        MemoryStream stream = new MemoryStream(data);

        StreamReader reader = new StreamReader(stream);

        int version = JsonConvert.DeserializeObject<int>(reader.ReadLine());
        int count = JsonConvert.DeserializeObject<int>(reader.ReadLine());

        Dictionary<ItemData.Type, List<ItemObject>>	items = new Dictionary<ItemData.Type, List<ItemObject>>();
        initInven(items);

        for(int i = 0; i < count; ++i)
        {
            ItemData.Type type = JsonConvert.DeserializeObject<ItemData.Type>(reader.ReadLine());
            UnityEngine.Debug.Log("Deserialize:" + type);

            switch(type)
            {
            case ItemData.Type.Weapon:
                ItemWeaponData weaponData = JsonConvert.DeserializeObject<ItemWeaponData>(reader.ReadLine());
                items[type].Add(new ItemObject(weaponData));
                break;
            case ItemData.Type.WeaponDNA:
                ItemWeaponDNAData dnaData = JsonConvert.DeserializeObject<ItemWeaponDNAData>(reader.ReadLine());
                m_weaponDNA = new ItemObject(dnaData);
                items[type].Add(m_weaponDNA);
                break;
            case ItemData.Type.WeaponParts:
                ItemWeaponPartsData weaponPartsData = JsonConvert.DeserializeObject<ItemWeaponPartsData>(reader.ReadLine());
                items[type].Add(new ItemObject(weaponPartsData));
                break;
            case ItemData.Type.Follower:
                ItemFollowerData followerData = JsonConvert.DeserializeObject<ItemFollowerData>(reader.ReadLine());
                items[type].Add(new ItemObject(followerData));
                break;
            case ItemData.Type.Accessory:
                ItemAccessoryData accessoryData = JsonConvert.DeserializeObject<ItemAccessoryData>(reader.ReadLine());
                items[type].Add(new ItemObject(accessoryData));
                break;
            case ItemData.Type.Skill:
                ItemSkillData skillData = JsonConvert.DeserializeObject<ItemSkillData>(reader.ReadLine());
                items[type].Add(new ItemObject(skillData));
                break;
            case ItemData.Type.Cheat:
                ItemCheatData cheatData = JsonConvert.DeserializeObject<ItemCheatData>(reader.ReadLine());
                items[type].Add(new ItemObject(cheatData));
                break;
            case ItemData.Type.Stat:
                ItemStatData statData = JsonConvert.DeserializeObject<ItemStatData>(reader.ReadLine());
                items[type].Add(new ItemObject(statData));
                break;

            default:
                Debug.Log(type);
                reader.ReadLine();
                break;
            }
        }

        m_warehouseData = JsonConvert.DeserializeObject<WarehouseData>(reader.ReadToEnd());
        m_warehouseData.m_version = version;
        m_warehouseData.m_items = items;

        m_gold.Item.Count = m_warehouseData.m_gold.Value;
        m_goldMedal.Item.Count = m_warehouseData.m_goldMedal.Value;
        m_gem.Item.Count = m_warehouseData.m_gem.Value;
        m_alienEssence.Item.Count = m_warehouseData.m_alienEssence.Value;

        reader.Close();
    }
예제 #54
0
 public void RemoveItem(ItemObject obj)
 {
     m_warehouseData.m_items[obj.Item.RefItem.type].Remove(obj);
 }
예제 #55
0
 IEnumerator DelayClickLevelUp(GUIInventorySlot invSlot, GUIInventorySlot.GUIPriceGemButton priceGemButton, bool gem, ItemObject selectedItem)
 {
     while(OnClickLevelup(invSlot, priceGemButton, gem, selectedItem, false) == true)
         yield return new WaitForSeconds (0.2f);
 }
예제 #56
0
        public void Update(ItemObject itemObj)
        {
            switch(m_role)
            {
            case Const.ButtonRole.Nothing:
            case Const.ButtonRole.Unlock:
                break;
            case Const.ButtonRole.Levelup:
                m_priceButton.NormalWorth = Const.GetItemLevelupWorth(itemObj.Item.Level, itemObj.Item.RefItem.levelup);
                m_gemButton.NormalWorth = Const.GetItemLevelupWorth(itemObj.Item.Level, itemObj.Item.RefItem.levelup);
                break;
            case Const.ButtonRole.Evolution:
                m_priceButton.NormalWorth = Const.GetItemLevelupWorth(itemObj.Item.Evolution+1, itemObj.Item.RefItem.evolution);
                m_gemButton.NormalWorth = Const.GetItemLevelupWorth(itemObj.Item.Evolution+1, itemObj.Item.RefItem.evolution);
                break;
            }

            m_priceButton.Update();
            m_gemButton.Update();
        }