Esempio n. 1
0
 public void OnAfterDeserialize()
 {
     if (primary_function_enum != null)
     {
         primary_function = (PrimaryFunction)Enum.Parse(typeof(PrimaryFunction), primary_function_enum);
     }
     if (hierarchy_rank_enum != null)
     {
         hierarchy_rank = (HierarchyRank)Enum.Parse(typeof(HierarchyRank), hierarchy_rank_enum);
     }
     if (item_function_enum != null)
     {
         item_function = (ItemFunction)Enum.Parse(typeof(ItemFunction), item_function_enum);
     }
     if (material_function_enum != null)
     {
         material_function = (MaterialFunction)Enum.Parse(typeof(MaterialFunction), material_function_enum);
     }
     if (morph_function_enum != null)
     {
         morph_function = (MorphFunction)Enum.Parse(typeof(MorphFunction), morph_function_enum);
     }
     if (animation_function_enum != null)
     {
         animation_function = (AnimationFunction)Enum.Parse(typeof(AnimationFunction), animation_function_enum);
     }
     if (artisttools_function_enum != null)
     {
         artisttools_function = (ArtistToolsFunction)Enum.Parse(typeof(ArtistToolsFunction), artisttools_function_enum);
     }
 }
Esempio n. 2
0
 // Start is called before the first frame update
 void Start()
 {
     mainCurrency  = Canvas.GetComponent <Currency>();
     enchant       = enchantmentSlot.GetComponent <ItemFunction>();
     textUpdate    = "increase the chance for a weapon to not be detected for 150G";
     defaultColour = infoText.color;
 }
Esempio n. 3
0
    public void PopulateValuesFromAssetSchematic(AssetSchematic schematic)
    {
        //Debug.Log("Populating values.");
        //Origin & Description
        this.item_id         = schematic.origin_and_description.mcs_id;
        this.item_name       = schematic.origin_and_description.name;
        this.collection_id   = schematic.origin_and_description.collection_id;
        this.collection_name = schematic.origin_and_description.collection_name;
        this.vendorId        = schematic.origin_and_description.vendor_id;


        //Version
        this.collection_version = schematic.version_and_control.collection_version;
        this.item_version       = schematic.version_and_control.item_version;
        this.mcs_version        = schematic.version_and_control.mcs_version;

        //Type & function
        this.function = schematic.type_and_function.item_function;
        this.rank     = schematic.type_and_function.hierarchy_rank;

        // TODO: Should be using AssetSchematic.ItemStructure instead.
        this.schematic            = new ItemSchematic();
        this.schematic.lods       = schematic.structure_and_physics.item_structure.lods;
        this.schematic.persistent = schematic.structure_and_physics.item_structure.persistent;

        if (this.function != ItemFunction.figure)
        {
            this.compatibilities         = new ItemCompatibilities();
            this.compatibilities.figures = schematic.version_and_control.compatibilities;
        }
        DownConvertDarwinSpecToProtoSpec();
    }
 public void AddFunction(ItemFunction func)
 {
     if (!Functions.Contains(func))
     {
         Functions.Add(func);
     }
     Functions.Sort();
 }
 // Start is called before the first frame update
 void Start()
 {
     forgeInfo     = "Pick a part and a material";
     defaultColour = infoText.color;
     resultFunc    = Result.GetComponent <ItemFunction>();
     WorldCanvas   = GameObject.Find("Canvas");
     mainCurrency  = WorldCanvas.GetComponent <Currency>();
 }
    public void ChangeItemSlot(ItemFunction item, ItemFunction slot)
    {
        //slot = item;
        slot.isBlank = false;
        item.isBlank = true;

        //setIcon logic
        int tempIconNumber;

        tempIconNumber = item.GetIconNumber();
        item.itemImage.SetActive(false);
        slot.itemImage = slot.icons[tempIconNumber];
        slot.SetIconNumber(tempIconNumber);
        slot.itemImage.SetActive(true);


        //Name Swap Logic
        slot.SetName(item.GetName());
        item.name = null;


        //Price Swap Logic
        slot.SetPrice(item.GetPrice());
        item.SetPrice(0.0f);

        //Quality Swap Logic
        slot.SetItemQuality(item.GetQuality());
        item.SetItemQuality(0.0f);

        //Tag Swap Logic
        string tagSwap;

        tagSwap = slot.GetTag();
        slot.SetTag(item.GetTag());
        item.SetTag(tagSwap);
        tagSwap = null;

        //Swap enchantment if item has it
        if (item.isEnchanted == true)
        {
            item.EnchantOff();
            slot.EnchantOn();
        }

        //Swap item type string
        string tempType;

        tempType = item.GetItemType();
        item.SetItemType("");
        slot.SetItemType(tempType);

        //Swap Colour logic
        Color tempColour;

        tempColour = item.GetImageColour();
        item.SetImageColour(new Color(1, 1, 1));
        slot.SetImageColour(tempColour);
    }
Esempio n. 7
0
 /// <summary>
 /// De-serialize the component
 /// </summary>
 /// <param name="reader">Reader instance</param>
 public override void Read(BinaryReader reader)
 {
     int1             = reader.ReadInt32();
     int2             = reader.ReadInt32();
     targeting        = reader.ReadBoolean();
     targetingMessage = reader.ReadFastString();
     useFunction      = (ItemFunction)reader.ReadInt32();
     paperDoll        = reader.ReadPackedSpriteID();
     type             = (ItemType)reader.ReadInt32();
 }
    // Update is called once per frame



    public void ShowTooltip(ItemFunction item)
    {
        toolTipPrice.text = (item.GetPrice() + "G");

        float newQual;
        float oldQual = item.GetQuality();

        newQual             = (Mathf.RoundToInt(oldQual / 0.5f) * 0.5f);
        toolTipQuality.text = (newQual + " / 5");

        toolTipName.text = item.GetName();
        toolTipMenu.SetActive(true);
    }
 public void AddItem(ItemFunction newItem)
 {
     for (int i = 0; (i < slots.Length) && (nextSlot == null); i++)
     {
         if (slots[i].GetComponent <ItemFunction>().isBlank == true)
         {
             nextSlot = slots[i];
             nextSlot.GetComponent <ItemFunction>().ChangeItemSlot(newItem, nextSlot.GetComponent <ItemFunction>());
             nextSlot.GetComponent <ItemFunction>().DeselectItem();
             nextSlot = null;
             break;
         }
     }
 }
 public void DeleteItem(ItemFunction item)
 {
     item.isBlank = true;
     if (itemImage != null)
     {
         item.itemImage.SetActive(false);
     }
     item.SetName(null);
     item.SetPrice(0);
     item.SetItemQuality(0);
     item.SetTag("EmptySlot");
     item.SetItemType("");
     if (item.GetEnchant())
     {
         item.EnchantOff();
     }
 }
Esempio n. 11
0
        /// <summary>
        /// Perform the given item function
        /// </summary>
        /// <param name="resultSet">Result</param>
        /// <param name="function">Item function to perform</param>
        /// <param name="user">User of the item</param>
        /// <param name="item">The item</param>
        /// <param name="useParams">Usage parameters</param>
        public static void DoItemFunction(ResultSet resultSet, ItemFunction function, EntityID user, EntityID item, Item.UseParams useParams)
        {
            switch (function)
            {
            case ItemFunction.HEAL:
                if (SkillFunctions.Heal(resultSet, user, item.e.item.int1))
                {
                    resultSet.AddConsumed(user, item);
                }

                break;

            case ItemFunction.CAST_LIGHTNING:
                if (SkillFunctions.CastLightning(resultSet, user, useParams.veci1, item.e.item.int2, item.e.item.int1))
                {
                    resultSet.AddConsumed(user, item);
                }

                break;

            case ItemFunction.CAST_FIREBALL:
                if (SkillFunctions.CastFireball(resultSet, user, item.e.item.int2, item.e.item.int1, useParams.veci1, true))
                {
                    resultSet.AddConsumed(user, item);
                }

                break;

            case ItemFunction.CAST_CONFUSE:
                if (SkillFunctions.CastConfuse(resultSet, user, useParams.veci1))
                {
                    resultSet.AddConsumed(user, item);
                }

                break;

            case ItemFunction.CAST_TELEPORT:
                if (SkillFunctions.Teleport(resultSet, user, useParams.veci1))
                {
                    resultSet.AddConsumed(user, item);
                }

                break;
            }
        }
Esempio n. 12
0
        private void btPEdit_Click(object sender, EventArgs e)
        {
            using (FrmSelectProperty f = new FrmSelectProperty(oPropertyCollection.ToArray()))
            {
                f.ShowDialog();
                if (f.DialogResult == System.Windows.Forms.DialogResult.OK)
                {
                    List <IItem> properties = f._Property.ToList();
                    //整理資料表
                    //移除不在新項目的欄位
                    for (int i = oPropertyCollection.Count; i-- > 0;)
                    {
                        if (!ItemFunction.ComparePropertyCollection(properties, oPropertyCollection[i]))
                        {
                            IItem  item  = oPropertyCollection[i];
                            string name  = item.Name + "[" + item.Unit + "]";
                            int    rowid = dgViewFormula.Rows.IndexOf(dgViewFormula.Rows.Cast <DataGridViewRow>().FirstOrDefault(r => r.Cells[0].Value.ToString() == name));
                            dgViewProperty.Rows.RemoveAt(rowid);
                            oPropertyCollection.RemoveAt(i);
                        }
                    }

                    //新增欄位於表格中
                    DataGridViewRow row;
                    for (int i = 0; i < properties.Count; i++)
                    {
                        if (oPropertyCollection.Count == 0 || !ItemFunction.ComparePropertyCollection(oPropertyCollection, properties[i]))
                        {
                            IItem  item = properties[i];
                            string name = item.Name + "[" + item.Unit + "]";
                            row = new DataGridViewRow();
                            row.Cells.Add(new DataGridViewTextBoxCell());
                            row.Cells[0].Value = item.ID;
                            row.Cells.Add(new DataGridViewTextBoxCell());
                            row.Cells[1].Value = name;
                            row.Cells.Add(new DataGridViewTextBoxCell());
                            row.Cells[2].Value = item.ProdType;
                            dgViewProperty.Rows.Insert(i, row);
                        }
                    }
                    oPropertyCollection = properties;
                }
            }
        }
Esempio n. 13
0
    private MESH_TYPE ItemFunctionToMeshType(ItemFunction function)
    {
        switch (function)
        {
        case ItemFunction.soft_wearable:
            return(MESH_TYPE.CLOTH);

        case ItemFunction.prop:
            return(MESH_TYPE.PROP);

        case ItemFunction.hair:
            return(MESH_TYPE.HAIR);

        case ItemFunction.figure:
            return(MESH_TYPE.BODY);

        default:
            return(MESH_TYPE.UNKNOWN);
        }
    }
    public void ConvertToWeapon(ItemFunction slot, float item1Qual, float item2Qual, float item3Qual, float item1Price, float item2Price, float item3Price, string newTag, Color I1Colour, Color I2Colour, Color I3Colour)
    {
        slot.quality   = ((item1Qual + item2Qual + item3Qual) / 3);
        slot.price     = (item1Price + item2Price + item3Price) * 1.2f;
        slot.tag       = "Item";
        slot.itemImage = sword;
        slot.SetItemType("Sword");
        slot.itemImage.SetActive(true);
        slot.iconNumber = 4;
        slot.itemImage.GetComponent <Image>().color = new Color(((I1Colour.r + I2Colour.r + I3Colour.r) / 3), ((I1Colour.g + I2Colour.g + I3Colour.g) / 3), ((I1Colour.b + I2Colour.b + I3Colour.b) / 3));
        string caseList = newTag;

        switch (caseList)
        {
        case "Sword":
            string nameAddon = SwordNames[Random.Range(0, SwordNames.Length - 1)];
            slot.gameObject.name = ("Sword of " + nameAddon);
            break;
        }
    }
    // Update is called once per frame
    void Update()
    {
        infoText.text  = forgeInfo;
        forgeCost.text = (Mathf.RoundToInt(price) + "G");
        if (ForgePart != null && ForgeMaterial != null)
        {
            Debug.Log("Creating item");
            ItemFunction PartFunc, MatFunc;

            MatFunc  = ForgeMaterial.GetComponent <ItemFunction>();
            PartFunc = ForgePart.GetComponent <ItemFunction>();
            resultFunc.SetItemType(PartFunc.GetItemType());
            resultFunc.SetName((MatFunc.GetName() + " " + PartFunc.GetName()));
            resultFunc.SetItemQuality(MatFunc.GetQuality());
            resultFunc.SetTag("Item");
            string CaseTpye = MatFunc.GetName();
            switch (CaseTpye)
            {
            case "Iron":
                matColour = new Color(0.4823529f, 0.4823529f, 0.4823529f);
                break;

            case "Copper":
                matColour = new Color(0.8862745f, 0.5921569f, 0.1529412f);
                break;

            case "Bronze":
                matColour = new Color(0.5849056f, 0.4014046f, 0.06897471f);
                break;

            case "Mythril":
                matColour = new Color(0.6427109f, 0.9528301f, 0.9528302f);
                break;
            }
            resultFunc.SetIcon(PartFunc.GetIconNumber());
            resultFunc.SetImageColour(matColour);
            Debug.Log(resultFunc.GetImageColour());
            resultFunc.SetPrice(PartFunc.GetPrice() * MatFunc.GetPrice());
            price = resultFunc.GetPrice();
        }
    }
Esempio n. 16
0
    public void useItem()
    {
        ItemType type = Reference.GetComponent <ItemPickable>().itemType;

        if (type == ItemType.Bag)
        {
            ItemFunction.Bag(this);
        }
        else if (type == ItemType.Telescopes)
        {
            ItemFunction.Telescopes(this);
        }
        else if (type == ItemType.Apparel)
        {
            ItemFunction.Apparel(this);
        }
        else if (type == ItemType.ProjectileWeapon)
        {
            ItemFunction.ProjectileWeapon(this);
        }
        else if (type == ItemType.MeleeWeapon)
        {
            ItemFunction.MeleeWeapon(this);
        }
        else if (type == ItemType.Medical)
        {
            ItemFunction.Medical(this);
        }
        else if (type == ItemType.Ammunition)
        {
            ItemFunction.Ammunition(this);
        }
        else if (type == ItemType.Misc)
        {
            ItemFunction.Misc(this);
        }
    }
Esempio n. 17
0
 // Start is called before the first frame update
 void Start()
 {
     sellFunction    = sellSlot.GetComponent <ItemFunction>();
     defaultDialogue = dialogueText.text;
 }
Esempio n. 18
0
 private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)// Combobox "Item to Keep/Sell/etc."
 {
     _CurrentItemFunction = (ItemFunction)comboBox2.SelectedIndex;
     RightListControlChanged();
 }
Esempio n. 19
0
 void Start()
 {
     instance = this;
     source   = GetComponent <AudioSource> ();
 }
 public void SellItem(ItemFunction sellSlot, float newPrice)
 {
     canvas.GetComponent <Currency>().currency += newPrice;
     DeleteItem(sellSlot);
 }
 public void RemoveFunction(ItemFunction func)
 {
     Functions.Remove(func);
     Functions.Sort();
 }
 // Start is called before the first frame update
 void Start()
 {
     CraftingSlot  = craftingSlot.GetComponent <ItemFunction>();
     craftingInfo  = "Add a Hilt, Blade and Grip to craft a sword";
     defaultColour = CraftingText.color;
 }
Esempio n. 23
0
    //during the import process unity gives us these arrays per gameobject - they are our metatadata from fbx
    public void PopulateValuesFromImportArrays(string[] names, object[] values)
    {
        for (int i = 0; i < names.Length; i++)
        {
            //our placeholder values - make sure you dont use a previous parsed bad value!!!
            string name = names[i];
            string string_value;
            float  float_value;

            switch (name)
            {
            case "hierarchy_rank":
                string_value = values[i].ToString();
                this.rank    = EnumHelper.ParseEnum <HierarchyRank>(string_value);
                break;

//				case "primary_function":
//					string_value = values[i].ToString();
//					this.function = EnumHelper.ParseEnum<PrimaryFunction>(string_value);
//					break;
            case "item_function":
                string_value  = values[i].ToString();
                this.function = EnumHelper.ParseEnum <ItemFunction>(string_value);
                break;

            case "collection_version":
                float_value             = float.Parse(values[i].ToString());
                this.collection_version = float_value;
                break;

            case "item_version":
                float_value       = float.Parse(values[i].ToString());
                this.item_version = float_value;
                break;

            case "mcs_version":
                float_value      = float.Parse(values[i].ToString());
                this.mcs_version = float_value;
                break;

            case "item_id":
                string_value = values[i].ToString();
                this.item_id = string_value;
                break;

            case "id":
                string_value = values[i].ToString();
                this.item_id = string_value;
                break;

            case "collection_id":
                string_value       = values[i].ToString();
                this.collection_id = string_value;
                break;

            case "item_name":
                string_value   = values[i].ToString();
                this.item_name = string_value;
                break;

            case "name":
                string_value   = values[i].ToString();
                this.item_name = string_value;
                break;

            case "collection_name":
                string_value         = values[i].ToString();
                this.collection_name = string_value;
                break;

            case "geometries":
                string_value   = values[i].ToString();                      //json bundle
                this.schematic = ItemSchematic.CreateFromJSON(string_value);
                break;

            case "compatibilities":
                string_value = values[i].ToString();                        //json bundle
                if (this.function != ItemFunction.figure)
                {
                    this.compatibilities = ItemCompatibilities.CreateFromJSON(string_value);
                }
                break;
            }
        }



        DownConvertDarwinSpecToProtoSpec();
    }
Esempio n. 24
0
    void Update()
    {
        Ray ray = Camera.main.ViewportPointToRay(new Vector3(0.5F, 0.5F, 0));

        LookingAt = Physics.Raycast(ray, out Hit, distance);

        if (LookingAt)
        {
            if (ItemDebugMonitor(Hit.transform.gameObject) && !PlayerInventory.inUI)
            {
                PointingAtPickable = true;
                PointingAtStorage  = false;
                PointingAtDoor     = false;
                PointingAtObject   = Hit.transform.gameObject;
                CheckItemPickUp();

                /*if (PointingAtObject.GetComponent<WeaponHandler>() == null)
                 * {
                 *  DisplayNotificationBox(PointingAtObject.GetComponent<ItemPickable>().name,
                 *  PointingAtObject.GetComponent<ItemPickable>().Quantity.ToString(),
                 *  PointingAtObject.GetComponent<ItemPickable>().ItemIcon);
                 * }*/
            }
            else if (Hit.transform.gameObject.tag == "Door")
            {
                PointingAtDoor = true;
                DoorFunction();
            }
            else if (Hit.transform.gameObject.GetComponent <StorageViewable>() != null)
            {
                PointingAtStorage  = true;
                PointingAtPickable = false;
                PointingAtDoor     = false;
                PointingAtObject   = Hit.transform.gameObject;
                CheckStorageViewable();
            }
            else
            {
                UI.root.NotificationBox.SetActive(false);
                PointingAtDoor     = false;
                PointingAtStorage  = false;
                PointingAtPickable = false;
            }
        }
        else
        {
            try
            {
                UI.root.NotificationBox.SetActive(false);
            }
            catch (Exception) { }
            PointingAtDoor     = false;
            PointingAtStorage  = false;
            PointingAtPickable = false;
        }

        //CheckHold();

        if (openDoor)
        {
            OpenDoor();
        }
        else if (closeDoor)
        {
            CloseDoor();
        }

        InteractGUI();

        if (Input.GetMouseButtonDown(0) && UI.root.QuickSlotGrid.GetComponent <QuickSlotGridManager>().selectedSlot != -1)
        {
            ItemSprite sprite = UI.root.QuickSlotGrid.transform.GetChild(UI.root.QuickSlotGrid.GetComponent <QuickSlotGridManager>().selectedSlot).GetComponent <QuickSlotManager>().Reference;
            if (sprite != null && sprite.Reference != null)
            {
                switch (sprite.Reference.GetComponent <ItemPickable>().itemType)
                {
                case ItemType.Ammunition:
                    ItemFunction.Ammunition(sprite);
                    break;

                case ItemType.Apparel:
                    ItemFunction.Apparel(sprite);
                    break;

                case ItemType.Bag:
                    ItemFunction.Bag(sprite);
                    break;

                case ItemType.Medical:
                    ItemFunction.Medical(sprite);
                    break;

                case ItemType.MeleeWeapon:
                    ItemFunction.MeleeWeapon(sprite);
                    break;

                case ItemType.Misc:
                    ItemFunction.Misc(sprite);
                    break;

                case ItemType.ProjectileWeapon:
                    ItemFunction.ProjectileWeapon(sprite);
                    break;

                case ItemType.Telescopes:
                    ItemFunction.Telescopes(sprite);
                    break;
                }
            }
        }
    }
 public bool HasFunction(ItemFunction func)
 {
     return(Functions.Contains(func));
 }
Esempio n. 26
0
 public ItemPool GetItem(ItemFunction itemType)
 {
     return items[(int)itemType];
 }