예제 #1
0
        public bool InsertMod(ModBase mod)
        {
            bool succesful = false;

            if (numOfModSlots == 0 || ((int)mod.modType != (int)itemType))
            {
                return(false);
            }


            int hasModIndex = HasMod(mod);

            if (hasModIndex > 0)
            {
                itemMods[hasModIndex] = null;
            }


            for (int i = 0; i < numOfModSlots; i++)
            {
                if (itemMods[i] == null)
                {
                    itemMods[i] = mod;
                    succesful   = true;
                    break;
                }
            }

            return(succesful);
        }
예제 #2
0
 /// <summary>
 /// Creates a new instance of the LoadParameters structure
 /// </summary>
 /// <param name="name">Sets the Name field</param>
 /// <param name="base">Sets the ModBase field</param>
 /// <param name="subClassName">Sets the SubClassTypeName field</param>
 /// <param name="asm">Sets the Assembly field</param>
 public LoadParameters(string name, ModBase @base, string subClassName, Assembly asm)
 {
     Name             = name;
     ModBase          = @base;
     SubClassTypeName = subClassName;
     Assembly         = asm;
 }
예제 #3
0
        public ModBase InsertMod(ModBase mod, int slot)
        {
            ModBase modSwap = null;

            if (numOfModSlots == 0 || (mod != null && ((int)mod.modType != (int)itemType)))
            {
                return(null);
            }

            int hasModIndex = HasMod(mod);

            if (hasModIndex > 0)
            {
                itemMods[hasModIndex] = null;
            }


            if (itemMods[slot] == null)
            {
                itemMods[slot] = mod;
            }
            else
            {
                modSwap        = itemMods[slot];
                itemMods[slot] = mod;
            }
            return(modSwap);
        }
예제 #4
0
    /// <summary>
    /// Entry point for your mod.
    /// </summary>
    public void StartEx(IModLoaderV1 loaderApi, IModConfigV1 modConfig)
    {
        _modLoader = (IModLoader)loaderApi;
        _modConfig = (IModConfig)modConfig;
        _logger    = (ILogger)_modLoader.GetLogger();
        _modLoader.GetController <IReloadedHooks>()?.TryGetTarget(out _hooks !);
#if (IncludeConfig)
        // Your config file is in Config.json.
        // Need a different name, format or more configurations? Modify the `Configurator`.
        // If you do not want a config, remove Configuration folder and Config class.
        var configurator = new Configurator(_modLoader.GetModConfigDirectory(_modConfig.ModId));
        _configuration = configurator.GetConfiguration <Config>(0);
        _configuration.ConfigurationUpdated += OnConfigurationUpdated;
#endif

        // Please put your mod code in the class below,
        // use this class for only interfacing with mod loader.
        _mod = new Mod(new ModContext()
        {
            Logger    = _logger,
            Hooks     = _hooks,
            ModLoader = _modLoader,
            ModConfig = _modConfig,
            Owner     = this,
#if (IncludeConfig)
            Configuration = _configuration,
#endif
        });
    }
예제 #5
0
        public override object OnModCall(ModBase mod, params object[] arguments)
        {
            if (arguments.Length == 0)
            {
                arguments = new object[1] {
                    0
                }
            }
            ;
            if (!(arguments[0] is int))
            {
                arguments[0] = 0;
            }

            int id = (int)arguments[0];

            if (id >= IEConsts.ENUM_OFFSET)
            {
                switch ((InternalModMessages)id)
                {
                }
            }
            else
            {
                switch ((ModMessages)id)
                {
                }
            }

            return(base.OnModCall(mod, arguments));
        }
예제 #6
0
 public Mod(string id, string name, string author, ModBase modObject)
 {
     this.id        = id;
     this.name      = name;
     this.author    = author;
     this.modObject = modObject;
 }
예제 #7
0
        /// <summary>
        /// Creates a new instance of the LoadParameters class
        /// </summary>
        /// <param name="name">Sets the Name field</param>
        /// <param name="base">Sets the ModBase field</param>
        /// <param name="subClassName">Sets the SubClassTypeName field</param>
        /// <param name="asm">Sets the Assembly field</param>
        public LoadParameters(string name, ModBase @base, string subClassName, Assembly asm = null)
        {
            Name = name;
            ModBase = @base;
            SubClassTypeName = subClassName;
			Assembly = (asm ?? @base.code) ?? @base.GetType().Assembly;
        }
예제 #8
0
 public MarketSlot(ModBase modBase, int index, int cIndex, Action <ItemSlot, Item> ActionSet,
                   Func <ItemSlot, Item> ActionGet, TradingInterface si)
     : base(modBase, "Slot", index, ActionSet, ActionGet)
 {
     this.slotIndex   = index;
     this.customIndex = cIndex;
     this.GI          = si;
 }
예제 #9
0
        internal static int Load(ModBase @base, string internalName, Invasion invasion)
        {
            invasion.ID = ++invasionNextType;

            invasions.Add(@base.mod.InternalName + ":" + internalName, invasion);
            invasionTypes.Add(invasion.ID, @base.mod.InternalName + ":" + internalName);

            return(invasion.ID);
        }
예제 #10
0
 public void QuickEquipSheildMod(ModBase sheildMod)
 {
     if (curSheild != null && curSheild.InsertMod(sheildMod))
     {
         StowAwayMod(sheildMod);
         sheildMod.transform.SetParent(curSheild.transform);
         sheildMod.gameObject.SetActive(true);
     }
 }
예제 #11
0
 public void QuickEquipWeaponMod(ModBase weaponMod)
 {
     if (weaponHolster[curWeapon] != null && weaponHolster[curWeapon].InsertMod(weaponMod))
     {
         StowAwayMod(weaponMod);
         weaponMod.transform.SetParent(weaponHolster[curWeapon].transform);
         weaponMod.gameObject.SetActive(true);
     }
 }
예제 #12
0
		static void LoadMod        (Mod      mod, ModBase  @base)
		{
			mod.enabled = true;

			mod.modBase = @base;
			@base.mod = mod;

			LoadModInternal(mod, @base);
		}
예제 #13
0
 public void QuickEquipSpecificMod(Item item, ModBase weaponMod)
 {
     if (item != null && item.InsertMod(weaponMod))
     {
         StowAwayMod(weaponMod);
         weaponMod.transform.SetParent(item.transform);
         weaponMod.gameObject.SetActive(true);
     }
 }
예제 #14
0
        public bool EquipMod(Item item, ModBase mod)
        {
            bool succesful = item.InsertMod(mod);;

            if (succesful)
            {
                mod.transform.SetParent(item.transform);
            }

            return(succesful);
        }
예제 #15
0
		// modified versions of ModController.LoadMod/LoadModInternal
		static void LoadModInternal(Mod      mod, ModBase  @base)
		{
			ModController.CheckModBaseAndInfo(mod, @base);

			Mods.mods.Add(mod);

			ModController.SetupNoContent(mod);

			@base.OnLoad();

			@base.SetTimesLoaded(@base.GetTimesLoaded() + 1);
		}
예제 #16
0
        public int HasMod(ModBase mod)
        {
            int index = -1;

            for (int i = 0; i < numOfModSlots; i++)
            {
                if (itemMods[i] == mod)
                {
                    index = i;
                    break;
                }
            }
            return(index);
        }
예제 #17
0
        public void EquipMod(Item item, ModBase mod, int slot)
        {
            ModBase oldMod = item.InsertMod(mod, slot);;

            if (mod != null)
            {
                mod.transform.SetParent(item.transform);
            }

            if (oldMod != null)
            {
                StowAwayMod(oldMod);
            }
        }
예제 #18
0
        //public
        public void LoadMod(string name, string path)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (path == null)
            {
                throw new ArgumentNullException("path");
            }
            if (!FileUtil.PathExists(path))
            {
                throw new Exception("path does not exist.");
            }
            if (!FileUtil.PathIsFile(path))
            {
                throw new Exception("path is not a file.");
            }

            AppDomain domain = AppDomain.CreateDomain(name);

            ServiceLocator.GetService <IExceptionHandler>().AddDomain(domain);
            Type    t   = typeof(ModBase);
            ModBase mod = null;

            try {
                mod = (ModBase)domain.CreateInstanceFromAndUnwrap(path, t.Name);
            } catch (Exception ex) {
                throw new Exception("Cannot create instance of mod.", ex);
            }
            if (mod == null)
            {
                throw new Exception("Cannot create instance of mod.");
            }

            mod.Load();

            if (mods.ContainsKey(name))
            {
                mods[name].Dispose();
                mods[name] = new ModContainer(domain, mod);
            }
            else
            {
                mods.TryAdd(name, new ModContainer(domain, mod));
            }
        }
예제 #19
0
        void StowAwayMod(ModBase mod)
        {
            switch (mod.modType)
            {
            case ModType.WeaponMod:
            {
                mod.transform.SetParent(weaponModInventoryObj.transform);
                break;
            }

            case ModType.SheildMod:
            {
                mod.transform.SetParent(sheildModInventoryObj.transform);
                break;
            }
            }
            mod.PickUp(new Vector3(0, 9999, 0));
            mod.gameObject.SetActive(false);
        }
예제 #20
0
        void UpdateInspectionUI()
        {
            Item item = referenceToOriginalIcon.GetItem();

            if (item == null)
            {
                return;
            }
            Vector3 centerPosition = inspectionPoolManager.transform.position;


            itemBeingInspectedIcon.SetLastPosition(centerPosition);
            itemBeingInspectedIcon.StoreItem(item);

            for (int i = 2; i < inspectionPoolManager.transform.childCount; i++)
            {
                ItemIconScript modIcon = inspectionPoolManager.transform.GetChild(i).GetComponent <ItemIconScript>();
                modIcon.StoreItem(null);
                int slotNum = i - 2;
                if (slotNum < item.numOfModSlots)
                {
                    ModBase mod = item.itemMods[slotNum];
                    if (mod != null)
                    {
                        modIcon.StoreItem(mod);
                    }
                    else
                    {
                        modIcon.emptyText = "Mod Component " + (slotNum + 1);
                    }

                    Vector3 dirToNewPos    = Quaternion.Euler(0, 0, 360.0f * ((float)slotNum / (float)item.numOfModSlots)) * (Vector3.up * 75);
                    Vector3 positionOffset = new Vector3(0, -15, 0);
                    modIcon.SetLastPosition(centerPosition + positionOffset + dirToNewPos);
                }
                else
                {
                    modIcon.SetLastPosition(new Vector3(0, 9999, 0));
                }
            }
        }
예제 #21
0
파일: MItem.cs 프로젝트: jayands/tAPI-SDK
 public MItem(ModBase @base, Item i)
     : base(@base, i)
 {
 }
예제 #22
0
 public CustomSwordInit(ModBase mb, Item I)
     : base(mb, I)
 {
 }
        internal static int Load(ModBase @base, string internalName, Invasion invasion)
        {
            invasion.ID = ++invasionNextType;

            invasions.Add(@base.mod.InternalName + ":" + internalName, invasion);
            invasionTypes.Add(invasion.ID, @base.mod.InternalName + ":" + internalName);

            return invasion.ID;
        }
 /// <summary>
 /// Adds the given <see cref="DateEvent" /> to the game.
 /// </summary>
 /// <param name="base">The <see cref="ModBase" /> that owns the <see cref="DateEvent" />.</param>
 /// <param name="internalName">The internal name of the <see cref="DateEvent" />.</param>
 /// <param name="event">The <see cref="DateEvent" /> to add.</param>
 public static void AddToGame(ModBase @base, string internalName, DateEvent @event)
 {
     events.Add(@base.mod.InternalName + ":" + internalName, @event);
 }
예제 #25
0
 public SubModBase(ModBase owner)
 {
     this.owner = owner;
 }
예제 #26
0
 public ModUIs(ModBase owner, GameObject canvas) : base(owner)
 {
     this.canvas = canvas;
 }
예제 #27
0
파일: MItem.cs 프로젝트: jayands/tAPI-SDK
 public MItem(ModBase @base, Item i)
     : base(@base, i)
 {
 }
예제 #28
0
 public MPrefix(ModBase @base, Prefix p)
     : base(@base, p)
 {
 }
예제 #29
0
        public TradingInterface(ModBase modBase) : base()
        {
            for (int i = 0; i < item.Length; i++)
            {
                item[i] = new Item();
            }

            this.modBase = modBase;

            itemSlot[OwnerItem] = new MarketSlot(this.modBase, OwnerItem, OwnerItem, delegate(ItemSlot slot, Item item)
                                                 { this.item[((MarketSlot)slot).customIndex] = item; }, (ItemSlot slot) => this.item[((MarketSlot)slot).customIndex], this);

            itemSlot[TradePrice] = new MarketSlot(this.modBase, TradePrice, TradePrice, delegate(ItemSlot slot, Item item)
                                                  { this.item[((MarketSlot)slot).customIndex] = item; }, (ItemSlot slot) => this.item[((MarketSlot)slot).customIndex], this);

            itemSlot[TradedItem] = new MarketSlot(this.modBase, TradedItem, TradedItem, delegate(ItemSlot slot, Item item)
                                                  { this.item[((MarketSlot)slot).customIndex] = item; }, (ItemSlot slot) => this.item[((MarketSlot)slot).customIndex], this);

            itemSlot[OwnerItem2] = new MarketSlot(this.modBase, OwnerItem2, OwnerItem2, delegate(ItemSlot slot, Item item)
                                                  { this.item[((MarketSlot)slot).customIndex] = item; }, (ItemSlot slot) => this.item[((MarketSlot)slot).customIndex], this);

            itemSlot[TradePrice2] = new MarketSlot(this.modBase, TradePrice2, TradePrice2, delegate(ItemSlot slot, Item item)
                                                   { this.item[((MarketSlot)slot).customIndex] = item; }, (ItemSlot slot) => this.item[((MarketSlot)slot).customIndex], this);

            itemSlot[TradedItem2] = new MarketSlot(this.modBase, TradedItem2, TradedItem2, delegate(ItemSlot slot, Item item)
                                                   { this.item[((MarketSlot)slot).customIndex] = item; }, (ItemSlot slot) => this.item[((MarketSlot)slot).customIndex], this);

            itemSlot[OwnerItem3] = new MarketSlot(this.modBase, OwnerItem3, OwnerItem3, delegate(ItemSlot slot, Item item)
                                                  { this.item[((MarketSlot)slot).customIndex] = item; }, (ItemSlot slot) => this.item[((MarketSlot)slot).customIndex], this);

            itemSlot[TradePrice3] = new MarketSlot(this.modBase, TradePrice3, TradePrice3, delegate(ItemSlot slot, Item item)
                                                   { this.item[((MarketSlot)slot).customIndex] = item; }, (ItemSlot slot) => this.item[((MarketSlot)slot).customIndex], this);

            itemSlot[TradedItem3] = new MarketSlot(this.modBase, TradedItem3, TradedItem3, delegate(ItemSlot slot, Item item)
                                                   { this.item[((MarketSlot)slot).customIndex] = item; }, (ItemSlot slot) => this.item[((MarketSlot)slot).customIndex], this);

            itemSlot[OwnerItem4] = new MarketSlot(this.modBase, OwnerItem4, OwnerItem4, delegate(ItemSlot slot, Item item)
                                                  { this.item[((MarketSlot)slot).customIndex] = item; }, (ItemSlot slot) => this.item[((MarketSlot)slot).customIndex], this);

            itemSlot[TradePrice4] = new MarketSlot(this.modBase, TradePrice4, TradePrice4, delegate(ItemSlot slot, Item item)
                                                   { this.item[((MarketSlot)slot).customIndex] = item; }, (ItemSlot slot) => this.item[((MarketSlot)slot).customIndex], this);

            itemSlot[TradedItem4] = new MarketSlot(this.modBase, TradedItem4, TradedItem4, delegate(ItemSlot slot, Item item)
                                                   { this.item[((MarketSlot)slot).customIndex] = item; }, (ItemSlot slot) => this.item[((MarketSlot)slot).customIndex], this);

            itemSlot[OwnerItem5] = new MarketSlot(this.modBase, OwnerItem5, OwnerItem5, delegate(ItemSlot slot, Item item)
                                                  { this.item[((MarketSlot)slot).customIndex] = item; }, (ItemSlot slot) => this.item[((MarketSlot)slot).customIndex], this);

            itemSlot[TradePrice5] = new MarketSlot(this.modBase, TradePrice5, TradePrice5, delegate(ItemSlot slot, Item item)
                                                   { this.item[((MarketSlot)slot).customIndex] = item; }, (ItemSlot slot) => this.item[((MarketSlot)slot).customIndex], this);

            itemSlot[TradedItem5] = new MarketSlot(this.modBase, TradedItem5, TradedItem5, delegate(ItemSlot slot, Item item)
                                                   { this.item[((MarketSlot)slot).customIndex] = item; }, (ItemSlot slot) => this.item[((MarketSlot)slot).customIndex], this);

            itemSlot[OwnerItem6] = new MarketSlot(this.modBase, OwnerItem6, OwnerItem6, delegate(ItemSlot slot, Item item)
                                                  { this.item[((MarketSlot)slot).customIndex] = item; }, (ItemSlot slot) => this.item[((MarketSlot)slot).customIndex], this);

            itemSlot[TradePrice6] = new MarketSlot(this.modBase, TradePrice6, TradePrice6, delegate(ItemSlot slot, Item item)
                                                   { this.item[((MarketSlot)slot).customIndex] = item; }, (ItemSlot slot) => this.item[((MarketSlot)slot).customIndex], this);

            itemSlot[TradedItem6] = new MarketSlot(this.modBase, TradedItem6, TradedItem6, delegate(ItemSlot slot, Item item)
                                                   { this.item[((MarketSlot)slot).customIndex] = item; }, (ItemSlot slot) => this.item[((MarketSlot)slot).customIndex], this);

            itemSlot[OwnerItem7] = new MarketSlot(this.modBase, OwnerItem7, OwnerItem7, delegate(ItemSlot slot, Item item)
                                                  { this.item[((MarketSlot)slot).customIndex] = item; }, (ItemSlot slot) => this.item[((MarketSlot)slot).customIndex], this);

            itemSlot[TradePrice7] = new MarketSlot(this.modBase, TradePrice7, TradePrice7, delegate(ItemSlot slot, Item item)
                                                   { this.item[((MarketSlot)slot).customIndex] = item; }, (ItemSlot slot) => this.item[((MarketSlot)slot).customIndex], this);

            itemSlot[TradedItem7] = new MarketSlot(this.modBase, TradedItem7, TradedItem7, delegate(ItemSlot slot, Item item)
                                                   { this.item[((MarketSlot)slot).customIndex] = item; }, (ItemSlot slot) => this.item[((MarketSlot)slot).customIndex], this);
        }
예제 #30
0
        // Update is called once per frame
        void Update()
        {
            if (initFinished)
            {
                if (ItemIconScript.dragEnded)
                {
                    Item itemToDrop = ItemIconScript.swap1.GetItem();

                    if (dropItem && itemToDrop != null)
                    {
                        ItemIconScript itemIconToDrop = ItemIconScript.swap1;
                        ItemIconScript modIcon        = ItemIconScript.swap1;
                        if (inspectionON)
                        {
                            itemIconToDrop = referenceToOriginalIcon;
                        }
                        bool isAMod = false;
                        bool notUnderInventoryObj = itemIconToDrop.GetParent() != inventoryPoolManager.gameObject;
                        if (!notUnderInventoryObj && inspectionON)
                        {
                            isAMod = ItemIconScript.swap1.GetItem().itemType == ItemType.Mod;
                        }
                        if (notUnderInventoryObj || isAMod)
                        {
                            switch (itemToDrop.itemType)
                            {
                            case ItemType.Weapon:
                            {
                                _playerInventory.DropEquippedWeapon(itemIconToDrop.transform.GetSiblingIndex());
                                TurnOffInspection();
                                break;
                            }

                            case ItemType.Sheild:
                            {
                                _playerInventory.DropCurrentlyEquippedSheild();
                                TurnOffInspection();
                                break;
                            }

                            case ItemType.Mod:
                            {
                                _playerInventory.DropSpecificModOnItem(itemIconToDrop.GetItem(), modIcon.transform.GetSiblingIndex() - 2);
                                break;
                            }
                            }
                        }
                        else
                        {
                            if (inspectionON && (ItemIconScript.swap1 == referenceToOriginalIcon || ItemIconScript.swap1 == itemBeingInspectedIcon))
                            {
                                TurnOffInspection();
                            }
                            _playerInventory.DropItem(itemToDrop);
                        }
                        UpdateUI();
                        if (inspectionON)
                        {
                            UpdateInspectionUI();
                        }

                        dropItem = false;
                    }
                    ItemIconScript.dragEnded = false;
                }
                if (ItemIconScript.inspect)
                {
                    if (ItemIconScript.swap1.GetItem() != null && ItemIconScript.swap2.GetItem() != null)
                    {
                        if (inspectionON)
                        {
                            GameObject.FindGameObjectWithTag("UIEventSystem").GetComponent <EventSystem>().SetSelectedGameObject(referenceToOriginalIcon.gameObject);
                        }

                        ToggleInspectEquipment(ItemIconScript.swap1);

                        if (inspectionON)
                        {
                            GameObject.FindGameObjectWithTag("UIEventSystem").GetComponent <EventSystem>().SetSelectedGameObject(itemBeingInspectedIcon.gameObject);
                        }
                    }

                    ItemIconScript.swap1 = null;
                    ItemIconScript.swap2 = null;

                    ItemIconScript.rdyToSwap = false;
                    ItemIconScript.inspect   = false;
                }
                if (ItemIconScript.rdyToSwap)
                {
                    Item item1 = ItemIconScript.swap1.GetItem();
                    Item item2 = ItemIconScript.swap2.GetItem();

                    bool slotCheckOk = true;

                    if (ItemIconScript.swap1.GetParent() == inventoryPoolManager.gameObject && ItemIconScript.swap2.GetParent() == inventoryPoolManager.gameObject)
                    {
                        slotCheckOk = false;
                    }

                    bool isAnOpenSlot   = item1 == null || item2 == null;
                    bool isSameItemType = false;


                    if (!isAnOpenSlot)
                    {
                        isSameItemType = item1.itemType == item2.itemType;

                        if (inspectionON && (itemBeingInspectedIcon == ItemIconScript.swap2 || itemBeingInspectedIcon.GetItem() == ItemIconScript.swap2.GetItem()))
                        {
                            if (itemBeingInspectedIcon.GetItem() != item1)
                            {
                                ToggleInspectEquipment(ItemIconScript.swap1);
                            }
                            slotCheckOk = false;
                        }

                        if (isSameItemType)
                        {
                            if (item1.itemType == ItemType.Mod)
                            {
                                ModBase mod1 = item1.GetComponent <ModBase>();
                                ModBase mod2 = item2.GetComponent <ModBase>();
                                isSameItemType = mod1.modType == mod2.modType;
                            }
                        }
                        else if (item1.itemType == ItemType.Mod || item2.itemType == ItemType.Mod)
                        {
                            Item isAMod  = item1.itemType == ItemType.Mod ? item1 : item2;
                            Item notAMod = item1.itemType == ItemType.Mod ? item2 : item1;

                            int hasModIndex = notAMod.HasMod((ModBase)isAMod);
                            if (hasModIndex == -1)
                            {
                                if ((int)notAMod.itemType == (int)isAMod.GetComponent <ModBase>().modType)
                                {
                                    _playerInventory.QuickEquipSpecificMod(notAMod, (ModBase)isAMod);
                                }
                            }
                        }
                    }
                    else if (item1 != null || item2 != null)
                    {
                        if (ItemIconScript.swap1.GetParent() == equipmentPoolManager.gameObject && ItemIconScript.swap2.GetParent() == equipmentPoolManager.gameObject)
                        {
                            if (ItemIconScript.swap1.transform.GetSiblingIndex() > 3 || ItemIconScript.swap2.transform.GetSiblingIndex() > 3)
                            {
                                slotCheckOk = false;
                            }
                        }
                        else if (slotCheckOk)
                        {
                            if (inspectionON)
                            {
                                ItemIconScript onInspectionSideIcon = ItemIconScript.swap1.GetParent() == inspectionPoolManager.gameObject ? ItemIconScript.swap1 : ItemIconScript.swap2;
                                ItemIconScript hasItemIcon1         = item1 == null ? ItemIconScript.swap2 : ItemIconScript.swap1;
                                if (onInspectionSideIcon != hasItemIcon1)
                                {
                                    if (hasItemIcon1.GetItem().itemType != ItemType.Mod)
                                    {
                                        slotCheckOk = false;
                                    }
                                    else if ((int)itemBeingInspectedIcon.GetItem().itemType != (int)hasItemIcon1.GetItem().GetComponent <ModBase>().modType)
                                    {
                                        slotCheckOk = false;
                                    }
                                }
                            }
                            else
                            {
                                ItemIconScript onEquipmentSideIcon = ItemIconScript.swap1.GetParent() == equipmentPoolManager.gameObject ? ItemIconScript.swap1 : ItemIconScript.swap2;
                                ItemIconScript hasItemIcon         = item1 == null ? ItemIconScript.swap2 : ItemIconScript.swap1;
                                //ItemIconScript doestHaveItemIcon = item1 == null ? ItemIconScript.swap1 : ItemIconScript.swap2;

                                if (onEquipmentSideIcon != hasItemIcon)
                                {
                                    switch (hasItemIcon.GetItem().itemType)
                                    {
                                    case ItemType.Weapon:
                                    {
                                        if (onEquipmentSideIcon.transform.GetSiblingIndex() > 3)
                                        {
                                            slotCheckOk = false;
                                        }
                                        break;
                                    }

                                    case ItemType.Sheild:
                                    {
                                        if (onEquipmentSideIcon.transform.GetSiblingIndex() < 4)
                                        {
                                            slotCheckOk = false;
                                        }
                                        break;
                                    }

                                    default:
                                    {
                                        slotCheckOk = false;
                                        break;
                                    }
                                    }
                                }
                            }
                        }
                    }

                    if (slotCheckOk && (isSameItemType || isAnOpenSlot))
                    {
                        int icon1Index = ItemIconScript.swap1.transform.GetSiblingIndex();
                        int icon2Index = ItemIconScript.swap2.transform.GetSiblingIndex();

                        Transform parent = ItemIconScript.swap1.transform.parent;
                        ItemIconScript.swap1.transform.SetParent(ItemIconScript.swap2.transform.parent);
                        ItemIconScript.swap2.transform.SetParent(parent);

                        ItemIconScript.swap1.transform.SetSiblingIndex(icon2Index);
                        ItemIconScript.swap2.transform.SetSiblingIndex(icon1Index);
                        UpdatePlayerInventory();
                        ItemIconScript.SwapItemIcons();
                    }
                    else
                    {
                        ItemIconScript.WipeSwap();
                    }
                    UpdateUI();
                    if (inspectionON)
                    {
                        UpdateInspectionUI();
                    }
                }
            }
        }
예제 #31
0
파일: File.cs 프로젝트: gartoks/GameEngineY
        ///// <summary>
        ///// Gets the current user's data path.
        ///// </summary>
        ///// <value>
        ///// The user's data path.
        ///// </value>
        //public static string DataPath => ModBase.FileManager.DataPath;

        /// <summary>
        /// Gets the mod's directory. Should only be used to get the own directory.
        /// </summary>
        /// <param name="mod">The mod.</param>
        /// <returns></returns>
        public static string ModDirectory(ModBase mod) => ModBase.FileManager.ModDirectory(mod);
예제 #32
0
 public CustomSwordInit(ModBase mb)
 {
     mb = this.ModBase();
 }
예제 #33
0
파일: MWorld.cs 프로젝트: jayands/tAPI-SDK
 public MWorld(ModBase @base)
     : base(@base)
 {
 }
예제 #34
0
파일: SdkUI.cs 프로젝트: jayands/tAPI-SDK
 internal SdkUI(ModBase @base)
     : base(@base)
 {
 }
예제 #35
0
 public MWorld(ModBase @base)
     : base(@base)
 {
 }
예제 #36
0
 public MPlayer(ModBase @base, Player p)
     : base(@base, p)
 {
 }
예제 #37
0
파일: MPrefix.cs 프로젝트: jayands/tAPI-SDK
 public MPrefix(ModBase @base, Prefix p)
     : base(@base, p)
 {
 }
예제 #38
0
파일: MNPC.cs 프로젝트: jayands/tAPI-SDK
 public MNPC(ModBase @base, NPC n)
     : base(@base, n)
 {
 }
예제 #39
0
        /// <summary>
        /// Creates a new instance of the ItemContainer class
        /// </summary>
        /// <param name="i">Sets the ContainedItem field</param>
        /// <param name="base">The calling mod's ModBase</param>
        /// <param name="index">The index of the Item slot</param>
        /// <param name="type">The type of the ItemContainer, used to identify it.</param>
        public ItemContainer(Item i, ModBase @base, int index = 0, string type = null)
            : base()
        {
            item = i;

            slot = new ItemSlotWrapper(this, @base, type ?? "ItemContainerImpl", index);
        }
예제 #40
0
        void U_SetChainTexture()
        {
            Item sel = player.inventory[player.selectedItem];

            if (player.itemAnimation < 0 && !player.delayUseItem) // not using it
            {
                return;
            }

            object attr = null;

            for (int i = 0; i < sel.modEntities.Count; i++)
            {
                object[] attrArr = sel.modEntities[i].GetType().GetCustomAttributes(typeof(ChainTextureAttribute), true);

                if (attrArr.Length > 0)
                {
                    attr = attrArr[0]; // there should be only one
                }
            }

            if (attr == null)
            {
                // reset
                if (Main.chainTexture != modBase.textures["Resources/Chains/Grapple Chain"])
                {
                    Main.chainTexture = modBase.textures["Resources/Chains/Grapple Chain"];
                }

                if (Main.chain3Texture != modBase.textures["Resources/Chains/Blue Moon Chain"])
                {
                    Main.chain3Texture = modBase.textures["Resources/Chains/Blue Moon Chain"];
                }
            }
            else
            {
                ChainTextureAttribute cta = (ChainTextureAttribute)attr;
                ModBase @base             = (Mods.mods.FirstOrDefault(m => m.InternalName == cta.ModInternalName) ?? AvalonMod.Instance.mod).modBase; // LINQ++

                string path = cta.TextureName;

                if (!path.StartsWith("/"))
                {
                    path = "Resources/Chains/" + cta.TextureName;
                }
                else
                {
                    path = path.Substring(1); // remove the leading '/'
                }
                if ([email protected](path))
                {
                    return; // hmmm....
                }
                Texture2D tex = @base.textures[path];

                if (cta.ReplaceFlailChain)
                {
                    Main.chain3Texture = tex;
                }
                else
                {
                    Main.chainTexture = tex;
                }
            }
        }
예제 #41
0
 internal ItemSlotWrapper(ItemContainer container, ModBase @base, string type, int index)
     : base(@base, type, index, (s, it) => container.ContainedItem = it, s => container.ContainedItem)
 {
     parent = new WeakReference<ItemContainer>(container);
 }
예제 #42
0
 public MNPC(ModBase @base, NPC n)
     : base(@base, n)
 {
 }
예제 #43
0
 public AttackModifier(ModBase mb)
 {
     mb = this.ModBase();
 }
예제 #44
0
파일: MProj.cs 프로젝트: jayands/tAPI-SDK
 public MProj(ModBase @base, Projectile p)
     : base(@base, p)
 {
 }
예제 #45
0
파일: MPlayer.cs 프로젝트: jayands/tAPI-SDK
 public MPlayer(ModBase @base, Player p)
     : base(@base, p)
 {
 }
예제 #46
0
 public MsgHandler(ModBase owner) : base(owner)
 {
 }
예제 #47
0
파일: Mod.cs 프로젝트: jayands/tAPI-SDK
        public override object OnModCall(ModBase mod, params object[] arguments)
        {
            if (arguments.Length == 0)
                arguments = new object[1] { 0 };
            if (!(arguments[0] is int))
                arguments[0] = 0;

            int id = (int)arguments[0];

            if (id >= IEConsts.ENUM_OFFSET)
                switch ((InternalModMessages)id)
                {

                }
            else
                switch ((ModMessages)id)
                {

                }

            return base.OnModCall(mod, arguments);
        }
예제 #48
0
        public override object OnModCall(ModBase mod, params object[] arguments)
        {
            if (arguments.Length == 0)
                arguments = new object[1] { 0 };
            if (!(arguments[0] is int))
                arguments[0] = 0;

            int id = (int)arguments[0];

#pragma warning disable 1522
            //if (id >= Consts.ENUM_OFFSET)
            //    switch ((InternalModMessages)id)
            //    {

            //    }
            //else
            //    switch ((ModMessages)id)
            //    {

            //    }
#pragma warning disable 1522

            return base.OnModCall(mod, arguments);
        }
예제 #49
0
파일: ModBase.cs 프로젝트: Nopezal/ToolsMod
 public ToolsBase(ModBase mb)
     : base(mb)
 {
 }
예제 #50
0
 public OrbLayer(ModBase @base)
     : base("ConversionMod:OrbLayer")
 {
     modBase = @base;
 }
예제 #51
0
        /// <summary>
        /// Creates a new instance of the ItemContainer class
        /// </summary>
        public ItemContainer(ModBase @base, int index = 0)
            : this(new Item(), @base)
        {

        }
예제 #52
0
 public Modifier(ModBase mb)
 {
     mb = this.ModBase();
 }
예제 #53
0
 /// <summary>
 /// Creates a new instance of the LoadParameters structure
 /// </summary>
 /// <param name="name">Sets the Name field</param>
 /// <param name="base">Sets the ModBase field</param>
 /// <param name="subClassName">Sets the SubClassTypeName field</param>
 /// <param name="asm">Sets the Assembly field</param>
 public LoadParameters(string name, ModBase @base, string subClassName, Assembly asm)
 {
     Name = name;
     ModBase = @base;
     SubClassTypeName = subClassName;
     Assembly = asm;
 }