Exemple #1
0
    public static List <GameObject> LoadData(List <GameObject> SlotList)
    {
        if (!System.IO.File.Exists(Application.dataPath + "/Resources/InventoryData.xml"))
        {
            return(SlotList);
        }

        XmlDocument XmlDoc = new XmlDocument();

        XmlDoc.Load(Application.dataPath + "/Resources/InventoryData.xml");
        XmlElement XmlEl = XmlDoc["ItemDB"];

        foreach (XmlElement ItemElement in XmlEl.ChildNodes)
        {
            Slot slot = SlotList[System.Convert.ToInt32(ItemElement.GetAttribute("SlotNumber"))].GetComponent <Slot>();

            Item item = new Item();

            string Name     = ItemElement.GetAttribute("Name");
            int    MaxCount = System.Convert.ToInt32(ItemElement.GetAttribute("MaxCount"));
            item.Init(Name, MaxCount);

            int Count = System.Convert.ToInt32(ItemElement.GetAttribute("Count"));

            for (int i = 0; i < Count; ++i)
            {
                slot.AddItem(item);
            }
        }
        return(SlotList);
    }
Exemple #2
0
    public void AddItemInBagUI(GameObject item)
    {
        ItemElement itemscript = item.GetComponent <ItemElement>();

        if (itemscript != null)
        {
            Destroy(itemscript);
        }

        int childcount = BagUI.childCount;

        item.transform.SetParent(BagUI);
        RectTransform trans = item.transform as RectTransform;
        float         ratio = 120 / trans.rect.width;

        trans.sizeDelta = new Vector2(trans.rect.size.x * ratio, trans.rect.size.y * ratio);

        MoveToCenter moveeffect = item.AddComponent <MoveToCenter>();

        moveeffect.SetLocalPos(GetBagPos(childcount));
        moveeffect.SetSpeed(3f);
        moveeffect.SetCallback(() =>
        {
            trans.localPosition = GetBagPos(childcount);
            item.AddComponent <ItemDragEffect>();
        });
    }
Exemple #3
0
 public ItemModel(string Name, double startingPrice, int id, ItemType type, ItemElement element)
 {
     itemName  = Name;
     itemId    = id;
     demand    = 1;
     basePrice = startingPrice;
 }
        public override Lesson ReadLesson()
        {
            var sco = new Sco
            {
                DataFromLms     = ItemElement.GetAttribute("datafromlms"),
                MaxTimeAllowed  = GetTime(ItemElement.GetAttribute("maxtimeallowed")),
                TimeLimitAction = ItemElement.GetAttribute("timelimitaction"),
                Prerequisites   = ItemElement.GetAttribute("prerequisites"),
                TargetWindow    = ItemElement.GetAttribute("winTarget")
            };

            FillStandardProperties(sco);

            var identifierRef   = ItemElement.GetAttribute("identifierref");
            var resourceElement = GetResourceElement(identifierRef);

            if (resourceElement != null)
            {
                sco.Resource = new ScormResource
                {
                    Base       = resourceElement.GetAttribute("base"),
                    Href       = resourceElement.GetAttribute("href"),
                    Identifier = IdentifierRef,
                    ScormType  = resourceElement.GetAttribute("scormtype"),
                    Type       = resourceElement.GetAttribute("type")
                };
            }
            return(sco);
        }
        /// <summary>
        /// Function to display shopping cart
        /// </summary>
        public void ShoppingCartDisplay()
        {
            ItemElement[] itemElements = new ItemElement[] { new Book(150, "NHDS456"), new Book(45, "ISBNJG6"), new Fruit(20, 2, "Orange"), new Fruit(130, 4, "Apple") };
            int           total        = this.CalculateCost(itemElements);

            Console.WriteLine("Total cost: " + total);
        }
        /// <summary>
        /// Shopping the cart.
        /// </summary>
        public void ShoppingCart()
        {
            ItemElement[] items = new ItemElement[] { new Book(20, "1234"), new Book(100, "5678"), new Fruit(10, 2, "Banana"), new Fruit(5, 5, "Apple") };
            ////calculate the total price
            int total = CalculatePrice(items);

            Console.WriteLine("Total Cost = " + total);
        }
        private string SnagValue(string nodeName)
        {
            var xmlNode = ItemElement.SelectSingleNode(nodeName);

            if (xmlNode == null)
            {
                return(String.Empty);
            }
            return(xmlNode.InnerText);
        }
Exemple #8
0
    public bool GetItemElementToType(int itemSmallType, out ItemElement itemElement)
    {
        itemElement = null;
        if (!_mItemElementListTotype.TryGetValue(itemSmallType, out itemElement))
        {
            return(false);
        }

        return(true);
    }
Exemple #9
0
    public bool GetItemElement(long itemLogicID, out ItemElement itemElement)
    {
        itemElement = null;
        if (!_mItemElementList.TryGetValue(itemLogicID, out itemElement))
        {
            return(false);
        }

        return(true);
    }
Exemple #10
0
        public void Delete(int id)
        {
            var ItemElement = new ItemElement
            {
                ItemElementId = id
            };

            unitOfWork.ItemElementRepository.Delete(ItemElement);
            unitOfWork.Save();
        }
Exemple #11
0
 private string Gump_WriteTilePic(ItemElement elem)
 {
     if (IsHued(elem.Hue.ToString()))
     {
         return(string.Format("tilepichue {1} {2} {3} {4}", elem.X, elem.Y, elem.ItemID, elem.Hue));
     }
     else
     {
         return(String.Format("tilepic {0} {1} {2}", elem.X, elem.Y, elem.ItemID));
     }
 }
Exemple #12
0
 private bool OperateItem(ItemElement rie)
 {
     //合法,检验项处理操作
     if (rie.ItemNo == 50004360 || rie.ItemNo == 50004370)
     {
         if (rie.RefRange != null)
         {
             rie.RefRange = rie.RefRange.Replace(";", SystemInfo.NewLine);
         }
     }
     return true;
 }
Exemple #13
0
        public void Update(ItemElementViewModel itemElementVM)
        {
            var ItemElement = new ItemElement
            {
                ItemElementId          = itemElementVM.ItemElementId,
                ItemElementName        = itemElementVM.ItemElementName,
                CategoryId             = itemElementVM.CategoryId,
                SubCategoryId          = itemElementVM.SubCategoryId,
                SubSubCategoryId       = itemElementVM.SubSubCategoryId,
                SubSubSubCategoryId    = itemElementVM.SubSubSubCategoryId,
                SubSubSubSubCategoryId = itemElementVM.SubSubSubSubCategoryId
            };

            unitOfWork.ItemElementRepository.Update(ItemElement);
            unitOfWork.Save();
        }
 public void UpdateItems()
 {
     foreach (Transform child in ItemsInExpense.transform)
     {
         GameObject.Destroy(child.gameObject);
     }
     if (Expense != null)
     {
         foreach (ItemToPay item in Expense.ItemsToPay)
         {
             ItemElement element = (ItemElement)Instantiate(ItemElementPrefab);
             element.PrimeButton(item);
             element.transform.SetParent(ItemsInExpense, false);
         }
     }
 }
Exemple #15
0
 public float this[ItemElement element]
 {
     get
     {
         if (_Cache.Element == element)
         {
             return(_Cache.Value);
         }
         for (int i = 0; i < _CrystalElements.Length; i++)
         {
             if (_CrystalElements[i].Element == element)
             {
                 _Cache = _CrystalElements[i];
                 return(_CrystalElements[i].Value);
             }
         }
         return(0);
     }
 }
Exemple #16
0
        /// <summary>
        /// Gets equip index at position. Must be in unscaled PaperDoll native coordinates.
        /// </summary>
        /// <param name="x">X position to sample.</param>
        /// <param name="y">Y position to sample.</param>
        /// <returns>Equip index or 0xff if point empty.</returns>
        public byte GetEquipIndex(int x, int y)
        {
            // Source mouse position is in classic coordinates
            // Item elements are in scaled coordinates
            // First scale mouse point to match scaled coordinates
            float   scaleX = target.width / (float)paperDollWidth;
            float   scaleY = target.height / (float)paperDollHeight;
            Vector2 point  = new Vector2(x * scaleX, y * scaleY);

            // Look for item texture pixel under mouse position
            // Iterating backwards over list as higher draw order added last
            // Return item equip slot index of first non-transparent pixel found under mouse
            for (int i = itemLayout.Count - 1; i >= 0; i--)
            {
                ItemElement element = itemLayout[i];
                if (element.item == null || element.texture == null)
                {
                    continue;
                }

                if (element.rect.Contains(point))
                {
                    // Get relative coordinates inside of item in 0-1 domain
                    float u = (point.x - element.rect.x) / element.rect.width;
                    float v = (point.y - element.rect.y) / element.rect.height;

                    // Read pixel colour at image coordinates inside of texture
                    // Remembering that Unity texture origin is bottom-left
                    int   imageX = (int)(element.texture.width * u);
                    int   imageY = (int)(element.texture.height * v);
                    Color color  = element.texture.GetPixel(imageX, element.texture.height - 1 - imageY);

                    // Return equip slot index if found, otherwise keep on searching down stack
                    if (color.a != 0)
                    {
                        return((byte)element.item.EquipSlot);
                    }
                }
            }

            return(0xff);
        }
Exemple #17
0
    public static List <Note_Item> Read(string filePath)
    {
        TextAsset   textxml  = (TextAsset)Resources.Load(filePath);
        XmlDocument Document = new XmlDocument();

        Document.LoadXml(textxml.text);

        XmlElement ItemListElement = Document["note"];

        List <Note_Item> ItemList = new List <Note_Item>();

        foreach (XmlElement ItemElement in ItemListElement.ChildNodes)
        {
            Note_Item Item = new Note_Item();
            Item.color = ItemElement.GetAttribute("color");
            Item.time  = System.Convert.ToSingle(ItemElement.GetAttribute("time"));
            ItemList.Add(Item);
        }
        return(ItemList);
    }
Exemple #18
0
        void DrawTexture(ImageData srcImage, Rect srcRect, Rect targetRect, DaggerfallUnityItem item = null)
        {
            // Calculate image position relative to origin
            int posX = (int)targetRect.xMin - paperDollOrigin.X;
            int posY = (int)targetRect.yMin - paperDollOrigin.Y;

            // Scale to paper doll render texture
            float scaleX = target.width / (float)paperDollWidth;
            float scaleY = target.height / (float)paperDollHeight;

            // Get target rect
            Rect screenRect = new Rect(
                posX * scaleX,
                posY * scaleY,
                targetRect.width * scaleX,
                targetRect.height * scaleY);

            // Allow for some adjustment so artist can finetune how their new item images should be positioned.
            TextureReplacement.OverridePaperdollItemRect(item, srcImage, scale, ref screenRect);

            // Draw with custom shader for paper doll item masking
            if (item != null)
            {
                paperDollMaterial.SetTexture("_MaskTex", srcImage.maskTexture);
                Graphics.DrawTexture(screenRect, srcImage.texture, srcRect, 0, 0, 0, 0, paperDollMaterial);
            }
            else
            {
                Graphics.DrawTexture(screenRect, srcImage.texture, srcRect, 0, 0, 0, 0);
            }

            // Store layout element for mouse picking
            if (item != null)
            {
                ItemElement element = new ItemElement();
                element.item    = item;
                element.rect    = screenRect;
                element.texture = srcImage.texture;
                itemLayout.Add(element);
            }
        }
Exemple #19
0
    public static List <Block> Read(string filePath)
    {
        List <Block> blockList = new List <Block>();
        XmlDocument  Document  = new XmlDocument();

        Document.Load(filePath);
        XmlElement ItemListElement = Document["MapList"];

        foreach (XmlElement ItemElement in ItemListElement.ChildNodes)
        {
            Block block = new Block
            {
                type = ItemElement.GetAttribute("Type"),
                x    = System.Convert.ToInt32(ItemElement.GetAttribute("X")),
                y    = System.Convert.ToInt32(ItemElement.GetAttribute("Y")),
                z    = System.Convert.ToInt32(ItemElement.GetAttribute("Z"))
            };
            blockList.Add(block);
        }
        return(blockList);
    }
Exemple #20
0
    public static void LoadData()
    {
        if (!System.IO.File.Exists(Application.dataPath + "/Resources/PlayerData.xml"))
        {
            return;
        }

        XmlDocument XmlDoc = new XmlDocument();

        XmlDoc.Load(Application.dataPath + "/Resources/PlayerData.xml");
        XmlElement XmlEl = XmlDoc["PlayerDB"];

        FSMPlayer player = GameSceneManager.Instance.Player;

        foreach (XmlElement ItemElement in XmlEl.ChildNodes)
        {
            player.Health.HP = System.Convert.ToSingle(ItemElement.GetAttribute("CurrentHP"));
            player.Mana.MP   = System.Convert.ToSingle(ItemElement.GetAttribute("CurrentMP"));
            player.Gold      = System.Convert.ToInt32(ItemElement.GetAttribute("Gold"));
        }
    }
Exemple #21
0
    public bool Import(JSONObject source)
    {
        // Recuperation du tableau de items
        ItemsList = new List <Item>();

        JSONArray array = source["items"].Array;

        foreach (JSONValue value in array)
        {
            ItemElement invItem = new ItemElement();
            foreach (KeyValuePair <string, JSONValue> itemEntry in value.Obj)
            {
                if (itemEntry.Key == "type")
                {
                    switch (itemEntry.Value.Str)
                    {
                    case "Ressource":
                        invItem.type = "Ressource";
                        break;

                    case "Equipment":
                        invItem.type = "Equipment";
                        break;

                    default:
                        invItem.type = "None";
                        break;
                    }
                }
                Item item;
                switch (invItem.type)
                {
                case "Ressource":
                    item         = new Ressource();
                    item.Type    = "Ressource";
                    invItem.type = "Ressource";
                    break;

                default:
                    item         = new Equipment();
                    item.Type    = "Equipment";
                    invItem.type = "Equipment";
                    break;
                }

                if (itemEntry.Key == "item")
                {
                    foreach (KeyValuePair <string, JSONValue> currentItem in itemEntry.Value.Obj)
                    {
                        if (currentItem.Key == "id")
                        {
                            item.Id = currentItem.Value.Str;
                        }
                        if (currentItem.Key == "itemName")
                        {
                            item.ItemName = currentItem.Value.Str;
                        }
                        if (currentItem.Key == "description")
                        {
                            item.Description = currentItem.Value.Str;
                        }
                        if (currentItem.Key == "inventorySprite")
                        {
                            item.InventorySprite = dictSprites[currentItem.Value.Str];
                        }
                        if (currentItem.Key == "ingameVisual")
                        {
                            item.IngameVisual = Resources.Load(currentItem.Value.Str) as GameObject;
                        }

                        if (item.Type == "Equipment")
                        {
                            if (currentItem.Key == "slot")
                            {
                                if (!Enum.IsDefined(typeof(EquipmentSlot), currentItem.Value.Str))
                                {
                                    return(false);
                                }
                                ((Equipment)item).Constraint = (EquipmentSlot)Enum.Parse(typeof(EquipmentSlot), currentItem.Value.Str, true);
                            }

                            if (currentItem.Key == "stat")
                            {
                                if (!Enum.IsDefined(typeof(Stat), currentItem.Value.Str))
                                {
                                    return(false);
                                }
                                ((Equipment)item).Stat = (Stat)Enum.Parse(typeof(Stat), currentItem.Value.Str, true);
                            }

                            if (currentItem.Key == "bonusStat")
                            {
                                ((Equipment)item).BonusToStat = (short)currentItem.Value.Number;
                            }
                        }

                        if (item.Type == "Ressource")
                        {
                            if (currentItem.Key == "use")
                            {
                                if (!Enum.IsDefined(typeof(ResourceFunctions), currentItem.Value.Str))
                                {
                                    return(false);
                                }
                                ((Ressource)item).ResourceUseIndex = (ResourceFunctions)Enum.Parse(typeof(ResourceFunctions), currentItem.Value.Str, true);
                            }

                            if (currentItem.Key == "value")
                            {
                                ((Ressource)item).Value = (int)currentItem.Value.Number;
                            }
                        }
                    }
                }
                invItem.item = item;
            }
            ItemsList.Add(invItem.item);
        }
        return(true);
    }
Exemple #22
0
        private StringWriter CreateBareScript()
        {
            StringWriter sw_Script = new StringWriter();
            //ArrayList al_Buttons = new ArrayList();
            //ArrayList al_Texts = new ArrayList();

            List <string> GumpCommands = new List <string>();
            List <string> GumpTexts    = new List <string>();


            sw_Script.WriteLine("// Created {0}, with Gump Studio.", DateTime.Now);
            sw_Script.WriteLine("// Exported with {0} ver {1}.", this.GetPluginInfo().PluginName, this.GetPluginInfo().Version);
            sw_Script.WriteLine("");

            if (!m_Designer.GumpProperties.Moveable)
            {
                GumpCommands.Add("NoMove");
            }

            if (!m_Designer.GumpProperties.Closeable)
            {
                GumpCommands.Add("NoClose");
            }

            if (!m_Designer.GumpProperties.Disposeable)
            {
                GumpCommands.Add("NoDispose");
            }

            if (m_Designer.Stacks.Count > 0)
            {
                int radiogroup = -1;
                int pageindex  = 0;
                // =================

                foreach (GroupElement ge_Elements in m_Designer.Stacks)
                {
                    GumpCommands.Add(Gump_WritePage(ref pageindex)); // "page pageid"
                    if (ge_Elements == null)
                    {
                        continue;
                    }

                    foreach (BaseElement be_Element in ge_Elements.GetElementsRecursive())
                    {
                        if (be_Element == null)
                        {
                            continue;
                        }

                        Type ElementType = be_Element.GetType();

                        if (ElementType == typeof(HTMLElement))
                        {
                            HTMLElement elem = be_Element as HTMLElement;
                            if (elem.TextType == HTMLElementType.HTML)
                            {
                                string cmd = Gump_WriteHTMLGump(elem, ref GumpTexts);
                                GumpCommands.Add(cmd);
                            }
                            else
                            {
                                string cmd = Gump_WriteXMFHtmlGump(elem);
                                GumpCommands.Add(cmd);
                            }
                        }
                        else if (ElementType == typeof(TextEntryElement))
                        {
                            TextEntryElement elem = be_Element as TextEntryElement;
                            string           cmd  = Gump_WriteTextEntry(elem, ref GumpTexts);
                            GumpCommands.Add(cmd);
                        }
                        else if (ElementType == typeof(LabelElement))
                        {
                            LabelElement elem = be_Element as LabelElement;
                            string       cmd  = Gump_WriteText(elem, ref GumpTexts);
                            GumpCommands.Add(cmd);
                        }

                        else if (ElementType == typeof(AlphaElement))
                        {
                            AlphaElement elem = be_Element as AlphaElement;
                            string       cmd  = Gump_WriteCheckerTrans(elem);
                            GumpCommands.Add(cmd);
                        }
                        else if (ElementType == typeof(BackgroundElement))
                        {
                            BackgroundElement elem = be_Element as BackgroundElement;
                            string            cmd  = Gump_WriteResizePic(elem);
                            GumpCommands.Add(cmd);
                        }
                        else if (ElementType == typeof(ImageElement))
                        {
                            ImageElement elem = be_Element as ImageElement;
                            string       cmd  = Gump_WriteGumpPic(elem);
                            GumpCommands.Add(cmd);
                        }
                        else if (ElementType == typeof(ItemElement))
                        {
                            ItemElement elem = be_Element as ItemElement;
                            string      cmd  = Gump_WriteTilePic(elem);
                            GumpCommands.Add(cmd);
                        }
                        else if (ElementType == typeof(TiledElement))
                        {
                            TiledElement elem = be_Element as TiledElement;
                            string       cmd  = Gump_WriteGumpPicTiled(elem);
                            GumpCommands.Add(cmd);
                        }

                        else if (ElementType == typeof(ButtonElement))
                        {
                            ButtonElement elem = be_Element as ButtonElement;
                            string        cmd  = Gump_WriteButton(elem);
                            GumpCommands.Add(cmd);
                        }

                        else if (ElementType == typeof(CheckboxElement))
                        {
                            CheckboxElement elem = be_Element as CheckboxElement;
                            string          cmd  = Gump_WriteCheckBox(elem);
                            GumpCommands.Add(cmd);
                        }
                        else if (ElementType == typeof(RadioElement))
                        {
                            RadioElement elem = be_Element as RadioElement;
                            if (elem.Group != radiogroup)
                            {
                                GumpCommands.Add("group " + elem.Group);
                                radiogroup = elem.Group;
                            }
                            string cmd = Gump_WriteRadioBox(elem);
                            GumpCommands.Add(cmd);
                        }
                    }
                }
            }
            sw_Script.WriteLine("");
            sw_Script.WriteLine("use uo;");
            sw_Script.WriteLine("use os;");
            sw_Script.WriteLine("");
            sw_Script.WriteLine("program gump_{0}(who)", frm_POLExportForm.GumpName);
            sw_Script.WriteLine("");

            sw_Script.WriteLine("\tvar gump := array {");

            int i = 1;

            foreach (string tmpCmd in GumpCommands)
            {
                sw_Script.Write("\t\t\"{0}\"", tmpCmd);

                if (i == GumpCommands.Count)
                {
                    sw_Script.WriteLine("");
                }
                else
                {
                    sw_Script.WriteLine(",", tmpCmd);
                }
                i++;
            }
            sw_Script.WriteLine("\t};");

            sw_Script.WriteLine("\tvar data := array {");

            i = 1;
            foreach (string tmpSe in GumpTexts)
            {
                sw_Script.Write("\t\t\"{0}\"", tmpSe);
                if (i == GumpTexts.Count)
                {
                    sw_Script.WriteLine("");
                }
                else
                {
                    sw_Script.WriteLine(",");
                }
                i++;
            }
            sw_Script.WriteLine("\t};");
            sw_Script.WriteLine("");
            sw_Script.WriteLine("\tSendDialogGump(who, gump, data{0});", Gump_Location(m_Designer.GumpProperties.Location));
            sw_Script.WriteLine("");
            sw_Script.WriteLine("endprogram");
            return(sw_Script);
        }
Exemple #23
0
 private void ConvertItem(ItemElement i1, Item i2)
 {
     i2.CName = i1.CName;
     i2.EName = i1.EName;
     i2.ItemNo = i1.ItemNo;
     i2.RefRange = i1.RefRange;
     i2.Result = i1.Result;
     i2.Status = i1.Status;
     i2.SuperNo = i1.SuperNo;
     i2.Unit = i1.Unit;
 }
Exemple #24
0
        private StringWriter CreateDistroScript(bool bShowComment, bool bShowNames, bool bDefaultTexts)
        {
            StringWriter  sw_Script    = new StringWriter();
            List <string> GumpCommands = new List <string>();

            bGetDefaultText = bDefaultTexts; // define if plugin will set default text for empty elems

            string gump_name = GetGumpName();

            GumpCommands.Add(DistroGump_GFCreateGump(gump_name, m_Designer.GumpProperties.Location));
            GumpCommands.Add("");
            if (!m_Designer.GumpProperties.Moveable)
            {
                GumpCommands.Add(String.Format("GFMovable({0}, 0);", gump_name));
            }

            if (!m_Designer.GumpProperties.Closeable)
            {
                GumpCommands.Add(String.Format("GFClosable({0}, 0);", gump_name));
            }

            if (!m_Designer.GumpProperties.Disposeable)
            {
                GumpCommands.Add(String.Format("GFDisposable({0}, 0);", gump_name));
            }


            if (m_Designer.Stacks.Count > 0)
            {
                int radiogroup = -1;
                int pageindex  = 0;
                // =================

                foreach (GroupElement ge_Elements in m_Designer.Stacks)
                {
                    if (pageindex > 0)
                    {
                        GumpCommands.Add("");
                    }

                    GumpCommands.Add(DistroGump_GFPage(gump_name, ref pageindex)); // "page pageid"
                    if (ge_Elements == null)
                    {
                        continue;
                    }

                    foreach (BaseElement be_Element in ge_Elements.GetElementsRecursive())
                    {
                        if (be_Element == null)
                        {
                            continue;
                        }

                        if (bShowComment || bShowNames)
                        {
                            string comment = GetCommentString(be_Element, bShowComment, bShowNames);
                            if (comment != String.Empty)
                            {
                                GumpCommands.Add("");
                                GumpCommands.Add(comment);
                            }
                        }

                        Type ElementType = be_Element.GetType();

                        if (ElementType == typeof(HTMLElement))
                        {
                            HTMLElement elem = be_Element as HTMLElement;
                            if (elem.TextType == HTMLElementType.HTML)
                            {
                                GumpCommands.Add(DistroGump_GFHTMLArea(gump_name, elem));
                            }
                            else
                            {
                                GumpCommands.Add(DistroGump_GFAddHTMLLocalized(gump_name, elem));
                            }
                        }
                        else if (ElementType == typeof(TextEntryElement))
                        {
                            TextEntryElement elem = be_Element as TextEntryElement;
                            GumpCommands.Add(DistroGump_GFTextEntry(gump_name, elem));
                        }
                        else if (ElementType == typeof(LabelElement))
                        {
                            LabelElement elem = be_Element as LabelElement;
                            GumpCommands.Add(DistroGump_GFTextLine(gump_name, elem));
                        }

                        else if (ElementType == typeof(AlphaElement))
                        {
                            AlphaElement elem = be_Element as AlphaElement;
                            GumpCommands.Add(DistroGump_GFAddAlphaRegion(gump_name, elem));
                        }
                        else if (ElementType == typeof(BackgroundElement))
                        {
                            BackgroundElement elem = be_Element as BackgroundElement;
                            GumpCommands.Add(DistroGump_GFResizePic(gump_name, elem));
                        }
                        else if (ElementType == typeof(ImageElement))
                        {
                            ImageElement elem = be_Element as ImageElement;
                            GumpCommands.Add(DistroGump_GFGumpPic(gump_name, elem));
                        }
                        else if (ElementType == typeof(ItemElement))
                        {
                            ItemElement elem = be_Element as ItemElement;
                            GumpCommands.Add(DistroGump_GFTilePic(gump_name, elem));
                        }
                        else if (ElementType == typeof(TiledElement))
                        {
                            // TODO: Support "GFGumpPicTiled" when it´s in distro
                            TiledElement elem = be_Element as TiledElement;
                            GumpCommands.Add("");
                            GumpCommands.Add("//Gump package does not support GumpPicTiled");
                            GumpCommands.Add("//" + Gump_WriteGumpPicTiled(elem));
                            GumpCommands.Add("");
                        }

                        else if (ElementType == typeof(ButtonElement))
                        {
                            ButtonElement elem = be_Element as ButtonElement;
                            GumpCommands.Add(DistroGump_GFAddButton(gump_name, elem));
                        }

                        else if (ElementType == typeof(CheckboxElement))
                        {
                            CheckboxElement elem = be_Element as CheckboxElement;
                            GumpCommands.Add(DistroGump_GFCheckBox(gump_name, elem));
                        }
                        else if (ElementType == typeof(RadioElement))
                        {
                            RadioElement elem = be_Element as RadioElement;
                            if (elem.Group != radiogroup)
                            {
                                GumpCommands.Add(String.Format("GFSetRadioGroup({0}, {1});", gump_name, elem.Group));
                                radiogroup = elem.Group;
                            }
                            GumpCommands.Add(DistroGump_GFRadioButton(gump_name, elem));
                        }
                    }
                }
            }


            sw_Script.WriteLine("// Created {0}, with Gump Studio.", DateTime.Now);
            sw_Script.WriteLine("// Exported with {0} ver {1} for gump pkg", this.GetPluginInfo().PluginName, this.GetPluginInfo().Version);
            sw_Script.WriteLine();
            sw_Script.WriteLine("use uo;");
            sw_Script.WriteLine("use os;");
            sw_Script.WriteLine();
            sw_Script.WriteLine("include \":gumps:gumps\";");
            sw_Script.WriteLine();
            sw_Script.WriteLine("program gump_{0}(who)", gump_name);
            sw_Script.WriteLine();

            foreach (string cmd in GumpCommands)
            {
                sw_Script.WriteLine("\t" + cmd);
            }
            sw_Script.WriteLine();
            sw_Script.WriteLine("\tGFSendGump(who, {0});", gump_name);
            sw_Script.WriteLine();
            sw_Script.WriteLine("endprogram");


            return(sw_Script);
        }
Exemple #25
0
        private string DistroGump_GFTilePic(string gump_name, ItemElement elem)
        {
            string hue = (elem.Hue != null) ? elem.Hue.ToString() : "0";

            return(String.Format("GFTilePic({0}, {1}, {2}, {3}, {4});", gump_name, elem.X, elem.Y, elem.ItemID, hue));
        }
Exemple #26
0
 private void FillItem(ItemElement item, FRItem data)
 {
     data.C0 = item.CName;
     data.C1 = item.EName;
     data.C2 = item.Result;
     data.C3 = item.Status;
     data.C4 = item.Unit;
     data.C5 = item.RefRange;
     data.C6 = item.ItemNo.ToString();
 }
Exemple #27
0
    private void Start()
    {
        mItemDataArr  = LoadOriginFiles.Instance.LoadItemDataArr();
        mEquipDataArr = LoadOriginFiles.Instance.LoadEquipDataArr();

        for (int i = 0; i < mItemDataArr.Length; i++)
        {
            ItemElement item = Instantiate(mItemElementPrefab, mScrollPos);
            item.Init(
                null,
                mItemDataArr[i].ID,
                mItemDataArr[i].Name,
                mItemDataArr[i].Cost,
                mItemDataArr[i].Info,
                mItemDataArr[i].Value,
                BuyItemOrEquip);
        }

        for (int i = 0; i < mEquipDataArr.Length; i++)
        {
            ItemElement equip = Instantiate(mItemElementPrefab, mScrollPos);
            equip.Init(
                null,
                mEquipDataArr[i].ID,
                mEquipDataArr[i].Name,
                mEquipDataArr[i].Cost,
                mEquipDataArr[i].Info,
                mEquipDataArr[i].Value,
                BuyItemOrEquip);
        }

        for (int i = 0; i < SaveLoadData.Instance.SaveData.ItemNum.Length; i++)
        {
            if (SaveLoadData.Instance.SaveData.ItemNum[i] > 0)
            {
                InvenElement inven = Instantiate(mInvenElemntPrefab, mInvenScrollPos);

                for (int j = 0; j < SaveLoadData.Instance.SaveData.ItemNum[i]; j++)
                {
                    inven.Init(
                        null,
                        mItemDataArr[i].ID,
                        mItemDataArr[i].Name);
                }

                mBoughtItemIDList.Add(inven);
            }
            else
            {
                InvenElement inven = Instantiate(mInvenElemntPrefab, mInvenScrollPos);
                inven.gameObject.SetActive(false);
                mBoughtItemIDList.Add(inven);
            }
        }

        for (int i = 0; i < SaveLoadData.Instance.SaveData.EquipNum.Length; i++)
        {
            if (SaveLoadData.Instance.SaveData.EquipNum[i] > 0)
            {
                InvenElement inven = Instantiate(mInvenElemntPrefab, mInvenScrollPos);

                for (int j = 0; j < SaveLoadData.Instance.SaveData.EquipNum[i]; j++)
                {
                    inven.Init(
                        null,
                        mEquipDataArr[i].ID,
                        mEquipDataArr[i].Name);
                }

                mBoughtEquipIDList.Add(inven);
            }
            else
            {
                InvenElement inven = Instantiate(mInvenElemntPrefab, mInvenScrollPos);
                inven.gameObject.SetActive(false);
                mBoughtEquipIDList.Add(inven);
            }
        }

        mGoldText.text = "Gold : " + UnitBuilder.GetUnitStr(DataPassing.Instance.Gold);
    }
Exemple #28
0
    public bool LoadBin(byte[] binContent)
    {
        m_mapElements.Clear();
        m_vecAllElements.Clear();
        int nCol, nRow;
        int readPos = 0;

        readPos += GameAssist.ReadInt32Variant(binContent, readPos, out nCol);
        readPos += GameAssist.ReadInt32Variant(binContent, readPos, out nRow);
        List <string> vecLine     = new List <string>(nCol);
        List <int>    vecHeadType = new List <int>(nCol);
        string        tmpStr;
        int           tmpInt;

        for (int i = 0; i < nCol; i++)
        {
            readPos += GameAssist.ReadString(binContent, readPos, out tmpStr);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out tmpInt);
            vecLine.Add(tmpStr);
            vecHeadType.Add(tmpInt);
        }
        if (vecLine.Count != 30)
        {
            Ex.Logger.Log("Item.csv中列数量与生成的代码不匹配!");
            return(false);
        }
        if (vecLine[0] != "ItemID")
        {
            Ex.Logger.Log("Item.csv中字段[ItemID]位置不对应"); return(false);
        }
        if (vecLine[1] != "Name")
        {
            Ex.Logger.Log("Item.csv中字段[Name]位置不对应"); return(false);
        }
        if (vecLine[2] != "Type")
        {
            Ex.Logger.Log("Item.csv中字段[Type]位置不对应"); return(false);
        }
        if (vecLine[3] != "FenLei")
        {
            Ex.Logger.Log("Item.csv中字段[FenLei]位置不对应"); return(false);
        }
        if (vecLine[4] != "FenLeiParameter")
        {
            Ex.Logger.Log("Item.csv中字段[FenLeiParameter]位置不对应"); return(false);
        }
        if (vecLine[5] != "Cishu")
        {
            Ex.Logger.Log("Item.csv中字段[Cishu]位置不对应"); return(false);
        }
        if (vecLine[6] != "Time")
        {
            Ex.Logger.Log("Item.csv中字段[Time]位置不对应"); return(false);
        }
        if (vecLine[7] != "Timeliness")
        {
            Ex.Logger.Log("Item.csv中字段[Timeliness]位置不对应"); return(false);
        }
        if (vecLine[8] != "SourceID")
        {
            Ex.Logger.Log("Item.csv中字段[SourceID]位置不对应"); return(false);
        }
        if (vecLine[9] != "LV")
        {
            Ex.Logger.Log("Item.csv中字段[LV]位置不对应"); return(false);
        }
        if (vecLine[10] != "Colour")
        {
            Ex.Logger.Log("Item.csv中字段[Colour]位置不对应"); return(false);
        }
        if (vecLine[11] != "ShiYong")
        {
            Ex.Logger.Log("Item.csv中字段[ShiYong]位置不对应"); return(false);
        }
        if (vecLine[12] != "HeCheng")
        {
            Ex.Logger.Log("Item.csv中字段[HeCheng]位置不对应"); return(false);
        }
        if (vecLine[13] != "IsSell")
        {
            Ex.Logger.Log("Item.csv中字段[IsSell]位置不对应"); return(false);
        }
        if (vecLine[14] != "ZiDong")
        {
            Ex.Logger.Log("Item.csv中字段[ZiDong]位置不对应"); return(false);
        }
        if (vecLine[15] != "IsBind")
        {
            Ex.Logger.Log("Item.csv中字段[IsBind]位置不对应"); return(false);
        }
        if (vecLine[16] != "IsAdd")
        {
            Ex.Logger.Log("Item.csv中字段[IsAdd]位置不对应"); return(false);
        }
        if (vecLine[17] != "AddNum")
        {
            Ex.Logger.Log("Item.csv中字段[AddNum]位置不对应"); return(false);
        }
        if (vecLine[18] != "Price")
        {
            Ex.Logger.Log("Item.csv中字段[Price]位置不对应"); return(false);
        }
        if (vecLine[19] != "IsDel")
        {
            Ex.Logger.Log("Item.csv中字段[IsDel]位置不对应"); return(false);
        }
        if (vecLine[20] != "DelPrice")
        {
            Ex.Logger.Log("Item.csv中字段[DelPrice]位置不对应"); return(false);
        }
        if (vecLine[21] != "BuyPrick")
        {
            Ex.Logger.Log("Item.csv中字段[BuyPrick]位置不对应"); return(false);
        }
        if (vecLine[22] != "MiaoShu")
        {
            Ex.Logger.Log("Item.csv中字段[MiaoShu]位置不对应"); return(false);
        }
        if (vecLine[23] != "BeiZhu")
        {
            Ex.Logger.Log("Item.csv中字段[BeiZhu]位置不对应"); return(false);
        }
        if (vecLine[24] != " Valuabl")
        {
            Ex.Logger.Log("Item.csv中字段[ Valuabl]位置不对应"); return(false);
        }
        if (vecLine[25] != "ModelId")
        {
            Ex.Logger.Log("Item.csv中字段[ModelId]位置不对应"); return(false);
        }
        if (vecLine[26] != "EffectID")
        {
            Ex.Logger.Log("Item.csv中字段[EffectID]位置不对应"); return(false);
        }
        if (vecLine[27] != "Mission")
        {
            Ex.Logger.Log("Item.csv中字段[Mission]位置不对应"); return(false);
        }
        if (vecLine[28] != "Skill")
        {
            Ex.Logger.Log("Item.csv中字段[Skill]位置不对应"); return(false);
        }
        if (vecLine[29] != "ItenR")
        {
            Ex.Logger.Log("Item.csv中字段[ItenR]位置不对应"); return(false);
        }

        for (int i = 0; i < nRow; i++)
        {
            ItemElement member = new ItemElement();
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.ItemID);
            readPos += GameAssist.ReadString(binContent, readPos, out member.Name);
            readPos += GameAssist.ReadString(binContent, readPos, out member.Type);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.FenLei);
            readPos += GameAssist.ReadString(binContent, readPos, out member.FenLeiParameter);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Cishu);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Time);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Timeliness);
            readPos += GameAssist.ReadString(binContent, readPos, out member.SourceID);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.LV);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Colour);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.ShiYong);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.HeCheng);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.IsSell);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.ZiDong);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.IsBind);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.IsAdd);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.AddNum);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Price);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.IsDel);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.DelPrice);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.BuyPrick);
            readPos += GameAssist.ReadString(binContent, readPos, out member.MiaoShu);
            readPos += GameAssist.ReadString(binContent, readPos, out member.BeiZhu);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Valuabl);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.ModelId);
            readPos += GameAssist.ReadString(binContent, readPos, out member.EffectID);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Mission);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Skill);
            readPos += GameAssist.ReadFloat(binContent, readPos, out member.ItenR);

            member.IsValidate = true;
            m_vecAllElements.Add(member);
            m_mapElements[member.ItemID] = member;
        }
        return(true);
    }
Exemple #29
0
 private ItemTable()
 {
     m_mapElements    = new Dictionary <int, ItemElement>();
     m_emptyItem      = new ItemElement();
     m_vecAllElements = new List <ItemElement>();
 }
Exemple #30
0
        private void GeneConvert(CustomElement custom, ItemElement item, int index)
        {
            string propName = null;
            propName = GetPropNameByIndex(index);
            this.SetProperty(propName, item.CName, custom);
            string[] values = item.Result.Split(new char[] { ';' });
            if (values.Length > 1)
            {
                index++;
                propName = GetPropNameByIndex(index);
                this.SetProperty(propName, values[0], custom);

                index++;
                propName = GetPropNameByIndex(index);
                this.SetProperty(propName, values[0], custom);
            }
        }
Exemple #31
0
 private bool IsItemLegal(ItemElement rie)
 {
     if (rie.SecretGrade > 0)
     {
         return false;
     }
     return true;
 }
Exemple #32
0
 private string Gump_WriteTilePic(ItemElement elem)
 {
     if (IsHued(elem.Hue.ToString()))
     {
         return string.Format("tilepichue {1} {2} {3} {4}", elem.X, elem.Y, elem.ItemID, elem.Hue);
     }
     else return String.Format("tilepic {0} {1} {2}", elem.X, elem.Y, elem.ItemID);
 }
Exemple #33
0
        private void writeOpcServerConfig(string fileName)
        {
            /*OPCServerConfig opcServerConfig = new OPCServerConfig();
             * List<string> inputsList = new List<string>();
             * List<string> outputsList = new List<string>();
             *
             * if (inputVars != null)
             * {
             *  foreach (NuTraceVariable inputVar in inputVars)
             *  {
             *      inputsList.Add(inputVar.Variable);
             *  }
             * }
             * if (outputVars != null)
             * {
             *  foreach (NuTraceVariable outputVar in outputVars)
             *  {
             *      outputsList.Add(outputVar.Variable);
             *  }
             * }
             * opcServerConfig.InputVariables = inputsList;
             * opcServerConfig.OutputVariables = outputsList;
             * opcServerConfig.SocketHost = "localhost";
             * opcServerConfig.SocketPort = 11000;*/

            ConfigBuilder.DefinitionList serverInemsDeflist = new ConfigBuilder.DefinitionList();
            {
                serverInemsDeflist.BranchSeperatorChar = '.';
                ConfigBuilder.BranchElement root = new BranchElement();
                {
                    root.name = "CIROS Connector";
                    ConfigBuilder.ConfigDefs defaultBranchConfig = new ConfigDefs();
                    defaultBranchConfig.activeDef              = true;
                    defaultBranchConfig.accRightSpecified      = false;
                    defaultBranchConfig.dataTypeSpecified      = false;
                    defaultBranchConfig.qualitySpecified       = false;
                    defaultBranchConfig.signalTypeSpecified    = false;
                    defaultBranchConfig.scanRateSpecified      = false;
                    defaultBranchConfig.deviceIDSpecified      = false;
                    defaultBranchConfig.deviceAddrSpecified    = false;
                    defaultBranchConfig.deviceSubAddrSpecified = false;
                    defaultBranchConfig.user1Specified         = false;
                    defaultBranchConfig.user2Specified         = false;
                    root.branchDefs = defaultBranchConfig;

                    ItemElement dummyItem = new ItemElement();
                    {
                        dummyItem.name                       = "dummyItem";
                        dummyItem.handle                     = 0;
                        dummyItem.itemDefs                   = new ConfigDefs();
                        dummyItem.Value                      = Convert.ToInt32(0);
                        dummyItem.itemDefs.dataType          = drvtypes.Type.SHORT;
                        dummyItem.itemDefs.activeDef         = true;
                        dummyItem.itemDefs.accRightSpecified = false;

                        dummyItem.itemDefs.dataTypeSpecified      = true;
                        dummyItem.itemDefs.qualitySpecified       = false;
                        dummyItem.itemDefs.signalTypeSpecified    = false;
                        dummyItem.itemDefs.scanRateSpecified      = false;
                        dummyItem.itemDefs.deviceIDSpecified      = false;
                        dummyItem.itemDefs.deviceAddrSpecified    = false;
                        dummyItem.itemDefs.deviceSubAddrSpecified = false;
                        dummyItem.itemDefs.user1Specified         = false;
                        dummyItem.itemDefs.user2Specified         = false;
                    }
                    root.items    = new ItemElement[1];
                    root.items[0] = dummyItem;

                    if (inputVars != null)
                    {
                        root.subBranches         = new BranchElement[1]; //TODO: 2
                        root.subBranches[0]      = new BranchElement();
                        root.subBranches[0].name = "Inputs";
                        {
                            ConfigBuilder.ConfigDefs branchConfig = new ConfigDefs();
                            branchConfig.activeDef         = true;
                            branchConfig.accRightSpecified = true;
                            branchConfig.accRight          = OPCAccess.READWRITEABLE;
                            branchConfig.dataTypeSpecified = false;
                            branchConfig.qualitySpecified  = true;
                            branchConfig.quality           = OPCQuality.GOOD;

                            branchConfig.signalTypeSpecified = false;
                            //branchConfig.signalTypeSpecified = true;
                            //branchConfig.signalType = SignalType.INTERN;

                            branchConfig.scanRate               = 100;
                            branchConfig.scanRateSpecified      = true;
                            branchConfig.deviceIDSpecified      = false;
                            branchConfig.deviceAddrSpecified    = false;
                            branchConfig.deviceSubAddrSpecified = false;
                            branchConfig.user1Specified         = false;
                            branchConfig.user2Specified         = false;

                            root.subBranches[0].branchDefs = branchConfig;
                        }

                        root.subBranches[0].items = new ItemElement[inputVars.Count];
                        int i = 0;
                        foreach (NuTraceVariable inputVar in inputVars)
                        {
                            ItemElement element = new ItemElement();
                            {
                                element.name     = inputVar.Variable;
                                element.handle   = i + 1;
                                element.itemDefs = new ConfigDefs();
                                try
                                {
                                    element.Value             = Convert.ToInt32(inputVar.Value);
                                    element.itemDefs.dataType = drvtypes.Type.SHORT;
                                }
                                catch (FormatException e)
                                {
                                    element.Value             = Convert.ToBoolean(inputVar.Value);
                                    element.itemDefs.dataType = drvtypes.Type.BOOLEAN;
                                }
                                element.itemDefs.activeDef         = true;
                                element.itemDefs.accRightSpecified = true;
                                element.itemDefs.accRight          = OPCAccess.READWRITEABLE;

                                element.itemDefs.dataTypeSpecified = true;
                                element.itemDefs.qualitySpecified  = true;
                                element.itemDefs.quality           = OPCQuality.GOOD;

                                element.itemDefs.signalTypeSpecified    = false;
                                element.itemDefs.scanRateSpecified      = false;
                                element.itemDefs.deviceIDSpecified      = false;
                                element.itemDefs.deviceAddrSpecified    = false;
                                element.itemDefs.deviceSubAddrSpecified = false;
                                element.itemDefs.user1Specified         = false;
                                element.itemDefs.user2Specified         = false;

                                /*element.itemDefs.properties = new PropertyDef[1];
                                 * {
                                 *  element.itemDefs.properties[0] = new PropertyDef();
                                 *  element.itemDefs.properties[0].id = 101;
                                 *  element.itemDefs.properties[0].name = "Item Description";
                                 *  element.itemDefs.properties[0].dataType = drvtypes.Type.STRING;
                                 *  element.itemDefs.properties[0].val = "Property test";
                                 *
                                 * }*/
                            }
                            root.subBranches[0].items[i++] = element;
                        }
                    }
                }
                serverInemsDeflist.DefinitionsRoot = root;
            }

            XmlSerializer ser = new XmlSerializer(typeof(ConfigBuilder.DefinitionList));
            StringBuilder sb  = new StringBuilder();

            using (TextWriter writer = new StringWriter(sb))
            {
                ser.Serialize(writer, serverInemsDeflist);
            }

            sb.Replace("xsi:nil=\"true\" ", ""); // hack removing xsi:nil="true"

            StreamWriter sw = new StreamWriter(fileName);

            sw.Write(sb);
            //ser.Serialize(writer, serverInemsDeflist);
            sw.Close();
        }
        public StringWriter GetSphereScript(bool bIsRevision)
        {
            StringWriter stringWriter1 = new StringWriter();
            ArrayList    arrayList1    = new ArrayList();
            ArrayList    arrayList2    = new ArrayList();

            stringWriter1.WriteLine("// Created {0}, with Gump Studio.", (object)DateTime.Now);
            stringWriter1.WriteLine("// Exported with with {0} ver {1}.", (object)this.GetPluginInfo().PluginName, (object)this.GetPluginInfo().Version);
            stringWriter1.WriteLine("// Script for {0}", bIsRevision ? (object)"0.56/Revisions" : (object)"0.99/1.0");
            stringWriter1.WriteLine("");
            stringWriter1.WriteLine("[DIALOG {0}]", (object)this.frm_SphereExportForm.GumpName);
            StringWriter stringWriter2 = stringWriter1;
            string       format        = "{0}";
            int          num1          = bIsRevision ? 1 : 0;
            Point        location      = ((GumpProperties)this.m_Designer.GumpProperties).Location;
            int          x             = location.X;

            location = ((GumpProperties)this.m_Designer.GumpProperties).Location;
            int    y   = location.Y;
            string str = this.Gump_WriteLocation(num1 != 0, x, y);

            stringWriter2.WriteLine(format, (object)str);
            if (!((GumpProperties)this.m_Designer.GumpProperties).Closeable)
            {
                stringWriter1.WriteLine("{0}", bIsRevision ? (object)"NOCLOSE" : (object)"NoClose");
            }
            if (!((GumpProperties)this.m_Designer.GumpProperties).Moveable)
            {
                stringWriter1.WriteLine("{0}", bIsRevision ? (object)"NOMOVE" : (object)"NoMove");
            }
            if (!((GumpProperties)this.m_Designer.GumpProperties).Disposeable)
            {
                stringWriter1.WriteLine("{0}", bIsRevision ? (object)"NODISPOSE" : (object)"NoDispose");
            }
            if (((ArrayList)this.m_Designer.Stacks).Count > 0)
            {
                int id1  = 0;
                int id2  = 0;
                int id3  = 0;
                int num2 = -1;
                for (int iPage = 0; iPage < ((ArrayList)this.m_Designer.Stacks).Count; ++iPage)
                {
                    stringWriter1.WriteLine("{0}", (object)this.Gump_WritePage(bIsRevision, iPage));
                    GroupElement stack = ((ArrayList)this.m_Designer.Stacks)[iPage] as GroupElement;
                    if (stack != null)
                    {
                        ArrayList elementsRecursive = stack.GetElementsRecursive();
                        if (elementsRecursive.Count > 0)
                        {
                            for (int index = 0; index < elementsRecursive.Count; ++index)
                            {
                                BaseElement baseElement = elementsRecursive[index] as BaseElement;
                                if (baseElement != null)
                                {
                                    HTMLElement htmlElement = baseElement as HTMLElement;
                                    if (htmlElement != null)
                                    {
                                        if (htmlElement.TextType == HTMLElementType.HTML)
                                        {
                                            if (bIsRevision)
                                            {
                                                string text = "HtmlGump id." + id1.ToString();
                                                if (htmlElement.HTML != null)
                                                {
                                                    arrayList2.Add((object)new SphereExporter.SphereElement(htmlElement.HTML.Length == 0 ? text : htmlElement.HTML, id1));
                                                }
                                                else
                                                {
                                                    arrayList2.Add((object)new SphereExporter.SphereElement(text, id1));
                                                }
                                            }
                                            stringWriter1.WriteLine("{0}", (object)this.Gump_WriteHTML(bIsRevision, ((BaseElement)htmlElement).X, ((BaseElement)htmlElement).Y, ((ResizeableElement)htmlElement).Width, ((ResizeableElement)htmlElement).Height, htmlElement.ShowBackground, htmlElement.ShowScrollbar, ref id1, htmlElement.HTML));
                                        }
                                        else
                                        {
                                            stringWriter1.WriteLine("{0}", (object)this.Gump_WriteXFHTML(bIsRevision, ((BaseElement)htmlElement).X, ((BaseElement)htmlElement).Y, ((ResizeableElement)htmlElement).Width, ((ResizeableElement)htmlElement).Height, htmlElement.ShowBackground, htmlElement.ShowScrollbar, htmlElement.CliLocID));
                                        }
                                    }
                                    else
                                    {
                                        AlphaElement alphaElement = baseElement as AlphaElement;
                                        if (alphaElement != null)
                                        {
                                            stringWriter1.WriteLine("{0}", (object)this.Gump_WriteCheckerTrans(bIsRevision, ((BaseElement)alphaElement).X, ((BaseElement)alphaElement).Y, ((ResizeableElement)alphaElement).Width, ((ResizeableElement)alphaElement).Height));
                                        }
                                        else
                                        {
                                            BackgroundElement backgroundElement = baseElement as BackgroundElement;
                                            if (backgroundElement != null)
                                            {
                                                stringWriter1.WriteLine("{0}", (object)this.Gump_WriteResizePic(bIsRevision, ((BaseElement)backgroundElement).X, ((BaseElement)backgroundElement).Y, ((ResizeableElement)backgroundElement).Width, ((ResizeableElement)backgroundElement).Height, backgroundElement.GumpID));
                                            }
                                            else
                                            {
                                                ButtonElement buttonElement = baseElement as ButtonElement;
                                                if (buttonElement != null)
                                                {
                                                    arrayList1.Add((object)new SphereExporter.SphereElement("// " + ((BaseElement)buttonElement).Name + "\n// " + buttonElement.Code, buttonElement.ButtonType == ButtonTypeEnum.Reply ? buttonElement.Param : id2));
                                                    stringWriter1.WriteLine("{0}", (object)this.Gump_WriteButton(bIsRevision, ((BaseElement)buttonElement).X, ((BaseElement)buttonElement).Y, buttonElement.NormalID, buttonElement.PressedID, buttonElement.ButtonType == ButtonTypeEnum.Page, buttonElement.Param, ref id2));
                                                }
                                                else
                                                {
                                                    ImageElement imageElement = baseElement as ImageElement;
                                                    if (imageElement != null)
                                                    {
                                                        stringWriter1.WriteLine("{0}", (object)this.Gump_WriteGumpPic(bIsRevision, ((BaseElement)imageElement).X, ((BaseElement)imageElement).Y, imageElement.GumpID, imageElement.Hue.ToString()));
                                                    }
                                                    else
                                                    {
                                                        ItemElement itemElement = baseElement as ItemElement;
                                                        if (itemElement != null)
                                                        {
                                                            stringWriter1.WriteLine("{0}", (object)this.Gump_WriteTilePic(bIsRevision, ((BaseElement)itemElement).X, ((BaseElement)itemElement).Y, itemElement.ItemID, itemElement.Hue.ToString()));
                                                        }
                                                        else
                                                        {
                                                            LabelElement labelElement = baseElement as LabelElement;
                                                            if (labelElement != null)
                                                            {
                                                                if (bIsRevision)
                                                                {
                                                                    string text = "Text id." + id1.ToString();
                                                                    if (labelElement.Text != null)
                                                                    {
                                                                        arrayList2.Add((object)new SphereExporter.SphereElement(labelElement.Text.Length == 0 ? text : labelElement.Text, id1));
                                                                    }
                                                                    else
                                                                    {
                                                                        arrayList2.Add((object)new SphereExporter.SphereElement(text, id1));
                                                                    }
                                                                }
                                                                stringWriter1.WriteLine("{0}", (object)this.Gump_WriteText(bIsRevision, ((BaseElement)labelElement).X, ((BaseElement)labelElement).Y, labelElement.Hue.ToString(), labelElement.Text, ref id1));
                                                            }
                                                            else
                                                            {
                                                                RadioElement radioElement = baseElement as RadioElement;
                                                                if (radioElement != null)
                                                                {
                                                                    if (radioElement.Group != num2)
                                                                    {
                                                                        stringWriter1.WriteLine("Group{0}", bIsRevision ? (object)(" " + radioElement.Group.ToString()) : (object)("(" + radioElement.Group.ToString() + ")"));
                                                                        num2 = radioElement.Group;
                                                                    }
                                                                    stringWriter1.WriteLine("{0}", (object)this.Gump_WriteRadioBox(bIsRevision, ((BaseElement)radioElement).X, ((BaseElement)radioElement).Y, ((CheckboxElement)radioElement).UnCheckedID, ((CheckboxElement)radioElement).CheckedID, radioElement.Checked, radioElement.Value));
                                                                }
                                                                else
                                                                {
                                                                    CheckboxElement checkboxElement = baseElement as CheckboxElement;
                                                                    if (checkboxElement != null)
                                                                    {
                                                                        stringWriter1.WriteLine("{0}", (object)this.Gump_WriteCheckBox(bIsRevision, ((BaseElement)checkboxElement).X, ((BaseElement)checkboxElement).Y, checkboxElement.UnCheckedID, checkboxElement.CheckedID, checkboxElement.Checked, ref id3));
                                                                    }
                                                                    else
                                                                    {
                                                                        TextEntryElement textEntryElement = baseElement as TextEntryElement;
                                                                        if (textEntryElement != null)
                                                                        {
                                                                            if (bIsRevision)
                                                                            {
                                                                                string text = "Textentry id." + textEntryElement.ID.ToString();
                                                                                if (textEntryElement.InitialText != null)
                                                                                {
                                                                                    arrayList2.Add((object)new SphereExporter.SphereElement(textEntryElement.InitialText.Length == 0 ? text : textEntryElement.InitialText, id1));
                                                                                }
                                                                                else
                                                                                {
                                                                                    arrayList2.Add((object)new SphereExporter.SphereElement(text, id1));
                                                                                }
                                                                            }
                                                                            stringWriter1.WriteLine("{0}", (object)this.Gump_WriteTextEntry(bIsRevision, ((BaseElement)textEntryElement).X, ((BaseElement)textEntryElement).Y, ((ResizeableElement)textEntryElement).Width, ((ResizeableElement)textEntryElement).Height, textEntryElement.Hue.ToString(), textEntryElement.InitialText, textEntryElement.ID, ref id1));
                                                                        }
                                                                        else
                                                                        {
                                                                            TiledElement tiledElement = baseElement as TiledElement;
                                                                            if (tiledElement != null)
                                                                            {
                                                                                stringWriter1.WriteLine("{0}", (object)this.Gump_WriteGumpPicTiled(bIsRevision, ((BaseElement)tiledElement).X, ((BaseElement)tiledElement).Y, ((ResizeableElement)tiledElement).Width, ((ResizeableElement)tiledElement).Height, tiledElement.GumpID));
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            stringWriter1.WriteLine("");
            if (bIsRevision)
            {
                stringWriter1.WriteLine("[DIALOG {0} text]", (object)this.frm_SphereExportForm.GumpName);
                foreach (SphereExporter.SphereElement sphereElement in arrayList2)
                {
                    stringWriter1.WriteLine("{0}", (object)sphereElement.sText);
                }
                stringWriter1.WriteLine("");
            }
            stringWriter1.WriteLine("[DIALOG {0} button]", (object)this.frm_SphereExportForm.GumpName);
            foreach (SphereExporter.SphereElement sphereElement in arrayList1)
            {
                stringWriter1.WriteLine("ON={0}", (object)sphereElement.iId.ToString());
                stringWriter1.WriteLine("{0}", (object)sphereElement.sText);
                stringWriter1.WriteLine("");
            }
            stringWriter1.WriteLine("{0}", (object)this.Gump_WriteEOF());
            return(stringWriter1);
        }
Exemple #35
0
    public bool LoadCsv(string strContent)
    {
        if (strContent.Length == 0)
        {
            return(false);
        }
        m_mapElements.Clear();
        m_vecAllElements.Clear();
        int           contentOffset = 0;
        List <string> vecLine;

        vecLine = GameAssist.readCsvLine(strContent, ref contentOffset);
        if (vecLine.Count != 30)
        {
            Ex.Logger.Log("Item.csv中列数量与生成的代码不匹配!");
            return(false);
        }
        if (vecLine[0] != "ItemID")
        {
            Ex.Logger.Log("Item.csv中字段[ItemID]位置不对应"); return(false);
        }
        if (vecLine[1] != "Name")
        {
            Ex.Logger.Log("Item.csv中字段[Name]位置不对应"); return(false);
        }
        if (vecLine[2] != "Type")
        {
            Ex.Logger.Log("Item.csv中字段[Type]位置不对应"); return(false);
        }
        if (vecLine[3] != "FenLei")
        {
            Ex.Logger.Log("Item.csv中字段[FenLei]位置不对应"); return(false);
        }
        if (vecLine[4] != "FenLeiParameter")
        {
            Ex.Logger.Log("Item.csv中字段[FenLeiParameter]位置不对应"); return(false);
        }
        if (vecLine[5] != "Cishu")
        {
            Ex.Logger.Log("Item.csv中字段[Cishu]位置不对应"); return(false);
        }
        if (vecLine[6] != "Time")
        {
            Ex.Logger.Log("Item.csv中字段[Time]位置不对应"); return(false);
        }
        if (vecLine[7] != "Timeliness")
        {
            Ex.Logger.Log("Item.csv中字段[Timeliness]位置不对应"); return(false);
        }
        if (vecLine[8] != "SourceID")
        {
            Ex.Logger.Log("Item.csv中字段[SourceID]位置不对应"); return(false);
        }
        if (vecLine[9] != "LV")
        {
            Ex.Logger.Log("Item.csv中字段[LV]位置不对应"); return(false);
        }
        if (vecLine[10] != "Colour")
        {
            Ex.Logger.Log("Item.csv中字段[Colour]位置不对应"); return(false);
        }
        if (vecLine[11] != "ShiYong")
        {
            Ex.Logger.Log("Item.csv中字段[ShiYong]位置不对应"); return(false);
        }
        if (vecLine[12] != "HeCheng")
        {
            Ex.Logger.Log("Item.csv中字段[HeCheng]位置不对应"); return(false);
        }
        if (vecLine[13] != "IsSell")
        {
            Ex.Logger.Log("Item.csv中字段[IsSell]位置不对应"); return(false);
        }
        if (vecLine[14] != "ZiDong")
        {
            Ex.Logger.Log("Item.csv中字段[ZiDong]位置不对应"); return(false);
        }
        if (vecLine[15] != "IsBind")
        {
            Ex.Logger.Log("Item.csv中字段[IsBind]位置不对应"); return(false);
        }
        if (vecLine[16] != "IsAdd")
        {
            Ex.Logger.Log("Item.csv中字段[IsAdd]位置不对应"); return(false);
        }
        if (vecLine[17] != "AddNum")
        {
            Ex.Logger.Log("Item.csv中字段[AddNum]位置不对应"); return(false);
        }
        if (vecLine[18] != "Price")
        {
            Ex.Logger.Log("Item.csv中字段[Price]位置不对应"); return(false);
        }
        if (vecLine[19] != "IsDel")
        {
            Ex.Logger.Log("Item.csv中字段[IsDel]位置不对应"); return(false);
        }
        if (vecLine[20] != "DelPrice")
        {
            Ex.Logger.Log("Item.csv中字段[DelPrice]位置不对应"); return(false);
        }
        if (vecLine[21] != "BuyPrick")
        {
            Ex.Logger.Log("Item.csv中字段[BuyPrick]位置不对应"); return(false);
        }
        if (vecLine[22] != "MiaoShu")
        {
            Ex.Logger.Log("Item.csv中字段[MiaoShu]位置不对应"); return(false);
        }
        if (vecLine[23] != "BeiZhu")
        {
            Ex.Logger.Log("Item.csv中字段[BeiZhu]位置不对应"); return(false);
        }
        if (vecLine[24] != " Valuabl")
        {
            Ex.Logger.Log("Item.csv中字段[ Valuabl]位置不对应"); return(false);
        }
        if (vecLine[25] != "ModelId")
        {
            Ex.Logger.Log("Item.csv中字段[ModelId]位置不对应"); return(false);
        }
        if (vecLine[26] != "EffectID")
        {
            Ex.Logger.Log("Item.csv中字段[EffectID]位置不对应"); return(false);
        }
        if (vecLine[27] != "Mission")
        {
            Ex.Logger.Log("Item.csv中字段[Mission]位置不对应"); return(false);
        }
        if (vecLine[28] != "Skill")
        {
            Ex.Logger.Log("Item.csv中字段[Skill]位置不对应"); return(false);
        }
        if (vecLine[29] != "ItenR")
        {
            Ex.Logger.Log("Item.csv中字段[ItenR]位置不对应"); return(false);
        }

        while (true)
        {
            vecLine = GameAssist.readCsvLine(strContent, ref contentOffset);
            if ((int)vecLine.Count == 0)
            {
                break;
            }
            if ((int)vecLine.Count != (int)30)
            {
                return(false);
            }
            ItemElement member = new ItemElement();
            member.ItemID          = Convert.ToInt32(vecLine[0]);
            member.Name            = vecLine[1];
            member.Type            = vecLine[2];
            member.FenLei          = Convert.ToInt32(vecLine[3]);
            member.FenLeiParameter = vecLine[4];
            member.Cishu           = Convert.ToInt32(vecLine[5]);
            member.Time            = Convert.ToInt32(vecLine[6]);
            member.Timeliness      = Convert.ToInt32(vecLine[7]);
            member.SourceID        = vecLine[8];
            member.LV       = Convert.ToInt32(vecLine[9]);
            member.Colour   = Convert.ToInt32(vecLine[10]);
            member.ShiYong  = Convert.ToInt32(vecLine[11]);
            member.HeCheng  = Convert.ToInt32(vecLine[12]);
            member.IsSell   = Convert.ToInt32(vecLine[13]);
            member.ZiDong   = Convert.ToInt32(vecLine[14]);
            member.IsBind   = Convert.ToInt32(vecLine[15]);
            member.IsAdd    = Convert.ToInt32(vecLine[16]);
            member.AddNum   = Convert.ToInt32(vecLine[17]);
            member.Price    = Convert.ToInt32(vecLine[18]);
            member.IsDel    = Convert.ToInt32(vecLine[19]);
            member.DelPrice = Convert.ToInt32(vecLine[20]);
            member.BuyPrick = Convert.ToInt32(vecLine[21]);
            member.MiaoShu  = vecLine[22];
            member.BeiZhu   = vecLine[23];
            member.Valuabl  = Convert.ToInt32(vecLine[24]);
            member.ModelId  = Convert.ToInt32(vecLine[25]);
            member.EffectID = vecLine[26];
            member.Mission  = Convert.ToInt32(vecLine[27]);
            member.Skill    = Convert.ToInt32(vecLine[28]);
            member.ItenR    = Convert.ToSingle(vecLine[29]);

            member.IsValidate = true;
            m_vecAllElements.Add(member);
            m_mapElements[member.ItemID] = member;
        }
        return(true);
    }
Exemple #36
0
 private bool ConvertCustom(ItemElement item, CustomElement custom)
 {
     string key = Item2CustomMap[item.ItemNo] as string;
     if (key != null)
     {
         this.SetProperty(key, item.Result, custom);
         return true;
     }
     return false;
 }
Exemple #37
0
 void OnEnable()
 {
     //获取当前编辑自定义Inspector的对象
     element = (ItemElement)target;
 }
Exemple #38
0
 private string DistroGump_GFTilePic(string gump_name, ItemElement elem)
 {
     string hue = (elem.Hue != null) ? elem.Hue.ToString() : "0";
     return String.Format("GFTilePic({0}, {1}, {2}, {3}, {4});", gump_name, elem.X, elem.Y, elem.ItemID, hue);
 }