private void FillSelectionSlots()  //Fills the selection menu with icons based on the current type
    {
        string        slotLabel = currentSelectionType.ToString();
        RectTransform lastTile  = unequipTile;

        Addressables.LoadAssetsAsync <ItemStats>(slotLabel, null).Completed += objects =>
        {
            foreach (ItemStats item in objects.Result)
            {
                if (playerData.GetIsItemUnlocked(item.itemAdress))
                {
                    //Spawns a new slot if the item is of the current category and moves it to the next open position either to the right or below the current row
                    ItemSlotBehavior addedSlot          = Instantiate(itemSlotPrefab, slotParentTransform).GetComponent <ItemSlotBehavior>();
                    RectTransform    addedSlotTransform = addedSlot.GetComponent <RectTransform>();
                    float            xOffset            = lastTile.GetComponent <RectTransform>().anchoredPosition.x + addedSlotTransform.rect.width + spawnSpacing.x;
                    float            yOffset            = lastTile.GetComponent <RectTransform>().anchoredPosition.y;
                    if (xOffset > slotParentTransform.rect.width / 2f)
                    {
                        xOffset = unequipTile.anchoredPosition.x;
                        yOffset = addedSlotTransform.sizeDelta.y + (spawnSpacing.y + addedSlotTransform.rect.height) * -1f;
                    }
                    addedSlotTransform.anchoredPosition = new Vector2(xOffset, yOffset);
                    addedSlot.SetData(item);
                    addedSlot.customsMenu = this;
                    lastTile = addedSlotTransform;
                    spawnedTiles.Add(addedSlot.gameObject);
                }
            }
        };
    }
Exemple #2
0
        public async Task SetActiveSlotAsync(MarketType marketType, SlotType slotType)
        {
            var key = GetActiveSlotKey(marketType);
            await _database.StringSetAsync(key, slotType.ToString());

            _activeSlot = slotType;
        }
Exemple #3
0
    public void CreateSlot(SlotType slotType)
    {
        Slot_ slot = new GameObject(slotType.ToString()).AddComponent <Slot_>().CreateSlot(slotType, owner);

        slot.transform.parent        = transform;
        slot.transform.localPosition = Vector3.zero;
        slots.Add(slot);
    }
Exemple #4
0
        public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
        {
            switch (strPropertyName.ToLower())
            {
            case "slotid": // Int
                return(SlotId.ToString(strFormat, formatProvider));

            case "conferenceid": // Int
                return(ConferenceId.ToString(strFormat, formatProvider));

            case "start": // Time
                return(Start.ToString(strFormat, formatProvider));

            case "durationmins": // Int
                return(DurationMins.ToString(strFormat, formatProvider));

            case "slottype": // Int
                return(SlotType.ToString(strFormat, formatProvider));

            case "title": // NVarChar
                if (Title == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(Title, strFormat));

            case "description": // NVarCharMax
                if (Description == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(Description, strFormat));

            case "daynr": // Int
                if (DayNr == null)
                {
                    return("");
                }
                ;
                return(((int)DayNr).ToString(strFormat, formatProvider));

            case "locationid": // Int
                if (LocationId == null)
                {
                    return("");
                }
                ;
                return(((int)LocationId).ToString(strFormat, formatProvider));

            default:
                propertyNotFound = true;
                break;
            }

            return(Null.NullString);
        }
Exemple #5
0
        /// <summary>
        /// Retrieve a module based on its slot
        /// Note: Must be in space.
        /// </summary>
        public IModule Module(SlotType slottype, int number)
        {
            if (number < 0 || number > 7)
            {
                throw new Exception("Slot number must be between 0 and 7, inclusive");
            }

            return(new Module(GetMember("Module", slottype.ToString() + number.ToString())));
        }
Exemple #6
0
        public void DumpField(TextWriter writer, string tab, bool isStatic)
        {
            writer.Write(tab);

            string vis = SyntaxFormatter.ToString(Visibility);

            if (!string.IsNullOrEmpty(vis))
            {
                writer.Write(vis);
                writer.Write(" ");
            }

            if (Kind == AbcTraitKind.Const)
            {
                writer.Write("const ");
            }
            else if (isStatic)
            {
                writer.Write("static ");
            }


            writer.Write(SlotType.ToString());
            writer.Write(" ");
            writer.Write(_name.ToString());

            if (HasValue)
            {
                writer.Write(" = ");
                var    val = SlotValue;
                string s   = val as string;
                if (s != null)
                {
                    writer.Write('\"');
                    writer.Write(s);
                    writer.Write('\"');
                }
                else
                {
                    writer.Write(val != null ? val.ToString() : "null");
                }
            }

            writer.Write(";");

            writer.WriteLine();
        }
Exemple #7
0
        bool BuildFilterProperty(TreeViewItem tvi, DDOItemData item, ItemProperty p, SlotType slot)
        {
            string prefix = "(" + (slot == SlotType.None ? "gear set filter" : slot.ToString() + " filter") + ") ";
            bool   added  = false;

            foreach (BuildFilter bf in Build.TestFilters[slot])
            {
                if (bf.Property == p.Property)
                {
                    if (bf.Type == null || bf.Type == p.Type || (bf.Type == "untyped" && string.IsNullOrWhiteSpace(p.Type)))
                    {
                        if (bf.Include)
                        {
                            TreeViewItem tvip = new TreeViewItem();
                            tvip.Header = prefix + p.Property + ", " + (string.IsNullOrWhiteSpace(p.Type) ? "untyped" : p.Type) + ", " + p.Value;
                            tvip.Tag    = item;
                            tvi.Items.Add(tvip);
                            added = true;
                        }
                    }
                }
                else if (p.Options != null && !p.HideOptions)
                {
                    foreach (var op in p.Options)
                    {
                        if (bf.Property == op.Property)
                        {
                            if (bf.Type == null || bf.Type == op.Type || (bf.Type == "untyped" && string.IsNullOrWhiteSpace(op.Type)))
                            {
                                if (bf.Include)
                                {
                                    TreeViewItem tvip = new TreeViewItem();
                                    tvip.Header = "> " + prefix + op.Property + ", " + (string.IsNullOrWhiteSpace(op.Type) ? "untyped" : op.Type) + ", " + op.Value;
                                    tvip.Tag    = item;
                                    tvi.Items.Add(tvip);
                                    added = true;
                                }
                            }
                        }
                    }
                }
            }

            return(added);
        }
        public XmlElement ToXml(XmlDocument doc)
        {
            XmlElement   xe = doc.CreateElement("Filter");
            XmlAttribute xa = doc.CreateAttribute("slot");

            xa.InnerText = Slot.ToString();
            xe.Attributes.Append(xa);
            if (Type != null)
            {
                xa           = doc.CreateAttribute("type");
                xa.InnerText = Type;
                xe.Attributes.Append(xa);
            }
            xa           = doc.CreateAttribute("include");
            xa.InnerText = Include.ToString();
            xe.Attributes.Append(xa);
            xe.InnerText = Property;

            return(xe);
        }
Exemple #9
0
    // Update is called once per frame
    void Update()
    {
        sprite = (type == SlotType.Active) ?
                 Resources.Load <Sprite>("Sprites/portrait_" + chara.type.ToString().ToLower()) as Sprite : null;

        if (type == SlotType.Active)
        {
            transform.Find("Back").GetComponent <Image>().color =
                chara.type == UnitType.Rifleman ? new Color(0, 1, 0, 0.2f) :
                chara.type == UnitType.Medic ? new Color(1, 0, 0, 0.2f) :
                chara.type == UnitType.Support ? new Color(0, 0, 1, 0.2f) :
                Color.black;
        }

        transform.Find("Class").GetComponent <Image>().sprite = sprite;
        transform.Find("Class").gameObject.SetActive(type == SlotType.Active);
        transform.Find("Overlay").GetComponent <Image>().sprite =
            (type == SlotType.Active && Input.GetKey(KeyCode.LeftShift)) ? down_switch :
            (type == SlotType.Active && Input.GetKey(KeyCode.LeftControl) && !current) ? down_delete :
            Resources.Load <Sprite>("Sprites/overlay_" + type.ToString().ToLower()) as Sprite;

        transform.Find("Active").gameObject.SetActive(current);
        gameObject.GetComponent <Button>().interactable = !(type == SlotType.Locked);
    }
Exemple #10
0
        /// <summary>
        /// Retrieve a module based on its slot
        /// Note: Must be in space.
        /// </summary>
        public IModule Module(SlotType slottype, int number)
        {
            if (number < 0 || number > 7)
                throw new Exception("Slot number must be between 0 and 7, inclusive");

            return new Module(GetMember("Module", slottype.ToString() + number.ToString()));
        }
 private void Awake()
 {
     Text.text = SlotType.ToString();
 }
Exemple #12
0
        public override string ToString()
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("------------------------------------------------\n");
            builder.Append(string.Format("Slot Id: 0x{0} ({1})\n", slotId.ToString("x8"), slotType.ToString()));
            builder.Append(string.Format("Visible: {0}\n", slotState.HasFlag(SlotStates.Visible)));

            if (owners.Count > 0)
            {
                builder.Append("Owners: ");
                foreach (uint owner in owners)
                {
                    builder.Append(string.Format("0x{0} ", owner.ToString("x8")));
                }
                builder.Append("\n");
            }
            else
            {
                builder.Append("Owners: <none>\n");
            }

            if (connectingSlots.Count > 0)
            {
                builder.Append("Connecting slots: ");
                foreach (uint slot in connectingSlots)
                {
                    builder.Append(string.Format("0x{0} ", slot.ToString("x8")));
                }
                builder.Append("\n");
            }
            else
            {
                builder.Append("Connecting slots: <none>\n");
            }

            return(builder.ToString());
        }
Exemple #13
0
 public void WriteXml(XmlWriter writer)
 {
     writer.WriteAttributeString("slot_type", typ.ToString());
     writer.WriteAttributeString("slot_id", id.ToString());
 }
        public static void PutOn(DressableAsset asset, SlotType slotType, PersonageModel personage)
        {
            if (!CanDress(asset, slotType))
            {
                UnityEngine.Debug.LogError(string.Format("Can't put on item {0} to slot {1}. Their slot types aren't matched!!! Item is destined for following slots {2}", asset.Classname, slotType.ToString(), string.Join(",", asset.OccupiedSlots)));
                return;
            }

            if (G.self.user_inventory.GetItemAmount(asset.Classname) < 1)
            {
                UnityEngine.Debug.LogError(string.Format("Can't put on item {0}. User don't have enough items", asset.Classname));
                return;
            }

            if (personage.TryGetConflictSlotItems(asset, out List <SlotItem> conflictItems))
            {
                for (int i = 0; i < conflictItems.Count; i++)
                {
                    TakeOff(conflictItems[i], personage);
                }
            }

            G.self.user_inventory.Decrease(asset.Classname);
            personage.PutOnItem(slotType, asset);
        }
Exemple #15
0
        public void Serialize()
        {
            // This is the XML Document which we are writing to.
            var doc = new XmlDocument();

            doc.AppendChild(doc.CreateXmlDeclaration("1.0", "utf-8", null));
            var root = doc.CreateElement("Object");

            Thread.CurrentThread.CurrentCulture = new CultureInfo(1033);
            var command = doc.CreateComment("Generated on " + DateTime.Today.ToShortDateString() + " at " + DateTime.Now.ToShortTimeString());

            doc.AppendChild(command);

            var objectType = doc.CreateAttribute("type");

            objectType.Value = ObjectType;
            root.Attributes.Append(objectType);

            var objectId = doc.CreateAttribute("id");

            objectId.Value = ObjectId;
            root.Attributes.Append(objectId);

            var @class = doc.CreateElement("Class"); // @class because "class" is a keyword

            @class.InnerText = Class;
            root.AppendChild(@class);

            var isItem = doc.CreateElement("Item");

            root.AppendChild(isItem);

            if (itemCreatorForm.RemoteTexture)
            {
                var remoteTexture = doc.CreateElement("RemoteTexture");
                var rtInstance    = doc.CreateElement("Instance");
                var rtId          = doc.CreateElement("Id");

                rtInstance.InnerText = RemoteTextureInstance;
                rtId.InnerText       = RemoteTextureId;

                remoteTexture.AppendChild(rtInstance);
                remoteTexture.AppendChild(rtId);

                root.AppendChild(remoteTexture);
            }
            else
            {
                var texture = doc.CreateElement("Texture");
                var tFile   = doc.CreateElement("File");
                var tIndex  = doc.CreateElement("Index");

                tFile.InnerText  = TextureFile;
                tIndex.InnerText = TextureIndex;

                texture.AppendChild(tFile);
                texture.AppendChild(tIndex);

                root.AppendChild(texture);
            }

            var slotType = doc.CreateElement("SlotType");

            slotType.InnerText = SlotType.ToString();
            root.AppendChild(slotType);

            var tier = doc.CreateElement("Tier");

            tier.InnerText = Tier == -1 ? "UT" : Tier.ToString();
            root.AppendChild(tier);

            var description = doc.CreateElement("Description");

            description.InnerText = Description;
            root.AppendChild(description);

            var rateOfFire = doc.CreateElement("RateOfFire");

            rateOfFire.InnerText = RateOfFire.ToString();
            root.AppendChild(rateOfFire);

            var sound = doc.CreateElement("sound");

            sound.InnerText = "weapon/blunt_sword";
            root.AppendChild(sound);

            var bagType = doc.CreateElement("BagType");

            bagType.InnerText = BagType.ToString();
            root.AppendChild(bagType);

            var oldSound = doc.CreateElement("OldSound");

            oldSound.InnerText = "bladeSwing";
            root.AppendChild(oldSound);

            var displayId = doc.CreateElement("DisplayId");

            displayId.InnerText = DisplayName;
            root.AppendChild(displayId);

            doc.AppendChild(root);

            var writer = new StringWriter();

            doc.Save(writer);

            var desktopFolder = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
            var fullFileName  = Path.Combine(desktopFolder, "Generated Item.xml");

            var dlr = MessageBox.Show(writer.ToString(), "Finished XML", MessageBoxButtons.YesNo);

            if (dlr != DialogResult.Yes)
            {
                return;
            }
            MessageBox.Show("Saving generated XML file to \r\n" + fullFileName);
            doc.Save(fullFileName);
        }
Exemple #16
0
 bool IsSlotLocked(SlotType slot)
 {
     if (slot == SlotType.None)
     {
         return(false);
     }
     else if (slot == SlotType.Finger)
     {
         return(CurrentBuild.LockedSlots.Contains(EquipmentSlotType.Finger1) || CurrentBuild.LockedSlots.Contains(EquipmentSlotType.Finger2));
     }
     else
     {
         return(CurrentBuild.LockedSlots.Contains((EquipmentSlotType)Enum.Parse(typeof(EquipmentSlotType), slot.ToString())));
     }
 }
Exemple #17
0
 public override string ToString()
 {
     return(SlotType.ToString() + " (" + SlotNumber + "/" + Id + ")");
 }
Exemple #18
0
 private static string GetKey(MarketType market, string assetPairId, CandlePriceType priceType, CandleTimeInterval timeInterval, SlotType slotType)
 {
     return($"CandlesHistory:{market}:{slotType.ToString()}:{assetPairId}:{priceType}:{timeInterval}");
 }