Ejemplo n.º 1
0
    public static void Init()
    {
        ItemEditor window = EditorWindow.GetWindow <ItemEditor> ();

        window.minSize = new Vector2(800, 400);
        window.Show();
    }
Ejemplo n.º 2
0
    private static void Init()
    {
        ItemEditor window = (ItemEditor)EditorWindow.GetWindow(typeof(ItemEditor));

        window.position = new Rect(Screen.width / 2f, Screen.height / 2f, 400f, 700f);
        window.Show();
    }
Ejemplo n.º 3
0
        protected override void OnCopyItem(object parameter)
        {            
            if (parameter == null || !CanEditItem(parameter))
                return;

            var item = ((ItemWrapper) parameter).WrappedItem;
            ItemWrapper copy;

            if (item is WeaponRecord)
                copy = new WeaponWrapper();
            else copy = new ItemWrapper();

            copy.Name = I18NDataManager.Instance.ReadText(item.NameId);
            copy.TypeId = (int) item.TypeId;
            copy.Description = I18NDataManager.Instance.ReadText(item.DescriptionId);
            copy.IconId = item.IconId;
            copy.Level = item.Level;
            copy.RealWeight = item.RealWeight;
            copy.Cursed = item.Cursed;
            copy.UseAnimationId = item.UseAnimationId;
            copy.Usable = item.Usable;
            copy.Targetable = item.Targetable;
            copy.Price = item.Price;
            copy.TwoHanded = item.TwoHanded;
            copy.Etheral = item.Etheral;
            copy.ItemSetId = (uint) item.ItemSetId;
            copy.Criteria = item.Criteria;
            copy.CriteriaTarget = item.CriteriaTarget;
            copy.HideEffects = item.HideEffects;
            copy.Enhanceable = item.Enhanceable;
            copy.NonUsableOnAnother = item.NonUsableOnAnother;
            copy.AppearanceId = item.AppearanceId;
            copy.SecretRecipe = item.SecretRecipe;
            copy.RecipeIds = item.RecipeIds;
            copy.BonusIsSecret = item.BonusIsSecret;
            copy.WrappedEffects = new ObservableCollection<EffectWrapper>(item.PossibleEffects.Select(EffectWrapper.Create));
            copy.FavoriteSubAreas = item.FavoriteSubAreas;
            copy.FavoriteSubAreasBonus = item.FavoriteSubAreasBonus;
            copy.Weight = item.Weight;

            if (item is WeaponRecord)
            {
                var weapon = item as WeaponRecord;
                var copy_weapon = copy as WeaponWrapper;

                copy_weapon.ApCost = weapon.ApCost;
                copy_weapon.MinRange = weapon.MinRange;
                copy_weapon.Range = weapon.Range;
                copy_weapon.CastInLine = weapon.CastInLine;
                copy_weapon.CastInDiagonal = weapon.CastInDiagonal;
                copy_weapon.CastTestLos = weapon.CastTestLos;
                copy_weapon.CriticalHitProbability = weapon.CriticalHitProbability;
                copy_weapon.CriticalHitBonus = weapon.CriticalHitBonus;
                copy_weapon.CriticalFailureProbability = weapon.CriticalFailureProbability;

            }

            var editor = new ItemEditor(copy);
            editor.Show();
        }
Ejemplo n.º 4
0
        protected override void OnEditItem(object parameter)
        {
            if (parameter == null || !CanEditItem(parameter))
                return;

            var editor = new ItemEditor(( (ItemWrapper)parameter ).WrappedItem);
            editor.Show();
        }
Ejemplo n.º 5
0
    static void Init()
    {
        // Get existing open window or if none, make a new one:
        ItemEditor editor = (ItemEditor)EditorWindow.GetWindow(typeof(ItemEditor));

        editor.minSize = new Vector2(1000, 600);
        editor.Show();
    }
Ejemplo n.º 6
0
    public static bool LoadItem(int instanceId, int line)
    {
        var obj = EditorUtility.InstanceIDToObject(instanceId);

        if (obj is ItemTemplate)
        {
            ItemEditor editor = GetWindow <ItemEditor>();
            editor.Show();
            return(true);
        }
        return(false);
    }
Ejemplo n.º 7
0
        public override void DoWindowContents(Rect inRect)
        {
            Text.Font = GameFont.Small;

            Widgets.Label(new Rect(0, 0, 450, 20), Translator.Translate("SettlementMarketTitle"));

            int  defSize            = stockList.Count * 45;
            Rect scrollRectFact     = new Rect(0, 50, 590, 495);
            Rect scrollVertRectFact = new Rect(0, 0, scrollRectFact.x, defSize);

            Widgets.DrawBox(new Rect(0, 49, 595, 500));
            Widgets.BeginScrollView(scrollRectFact, ref scrollPosition, scrollVertRectFact);
            int x = 0;

            for (int i = 0; i < stockList.Count; i++)
            {
                if (i >= stockList.Count)
                {
                    break;
                }

                Thing good = stockList[i];

                Widgets.DrawBoxSolid(new Rect(5, x, 575, 40), new Color(0, 0, 0, 0.75f));
                Widgets.Label(new Rect(5, x, 240, 40), good.Label);
                int.TryParse(Widgets.TextField(new Rect(245, x, 215, 40), good.stackCount.ToString()), out good.stackCount);
                if (Widgets.ButtonText(new Rect(460, x, 110, 40), Translator.Translate("DeleteGood")))
                {
                    DeleteGood(good);
                }
                x += 44;
            }
            Widgets.EndScrollView();

            if (Widgets.ButtonText(new Rect(0, 560, 610, 20), Translator.Translate("RegenerateStock")))
            {
                RegenerateStock();
            }

            if (Widgets.ButtonText(new Rect(0, 590, 610, 20), Translator.Translate("AddNewItemIntoStock")))
            {
                itemsMenu.Show(stockList);
            }
        }
Ejemplo n.º 8
0
 private void bItemListEditor_Click(object sender, EventArgs e)
 {
     ItemEditor.Show();
 }
Ejemplo n.º 9
0
 private void mItemIncl_Click(object sender, EventArgs e)
 {
     ItemEditor.Show();
 }
Ejemplo n.º 10
0
        private void OnCreateWeapon(object parameter)
        {
            var editor = new ItemEditor(new WeaponWrapper());

            editor.Show();
        }
Ejemplo n.º 11
0
        private static void OnCreateItem(object parameter)
        {
            var editor = new ItemEditor(new ItemWrapper());

            editor.Show();
        }
Ejemplo n.º 12
0
    static void ShowEditWindow()
    {
        ItemEditor myWindow = (ItemEditor)EditorWindow.GetWindow(typeof(ItemEditor), false, "", true); //创建窗口

        myWindow.Show();                                                                               //展示
    }
Ejemplo n.º 13
0
        public override void DoWindowContents(Rect inRect)
        {
            Text.Font = GameFont.Small;

            Widgets.Label(new Rect(0, 0, 240, 20), Translator.Translate("AdditemStashTitle"));

            Widgets.Label(new Rect(0, 25, 300, 20), Translator.Translate("SiteParts"));
            int  size2               = DefDatabase <SitePartDef> .AllDefsListForReading.Count * 25;
            Rect scrollRectFact2     = new Rect(0, 45, 300, 200);
            Rect scrollVertRectFact2 = new Rect(0, 0, scrollRectFact2.x, size2);

            Widgets.BeginScrollView(scrollRectFact2, ref scroll, scrollVertRectFact2);
            int x = 0;

            foreach (var sitePart in DefDatabase <SitePartDef> .AllDefsListForReading)
            {
                if (Widgets.RadioButtonLabeled(new Rect(0, x, 290, 20), sitePart.defName, parts.Contains(sitePart)))
                {
                    if (parts.Contains(sitePart))
                    {
                        parts.Remove(sitePart);
                    }
                    else
                    {
                        parts.Add(sitePart);
                    }
                }
                x += 22;
            }
            Widgets.EndScrollView();

            Widgets.Label(new Rect(310, 25, 240, 20), Translator.Translate("FactionOwner"));
            int  factionDefSize      = Find.FactionManager.AllFactionsListForReading.Count * 25;
            Rect scrollRectFact3     = new Rect(310, 48, 300, 200);
            Rect scrollVertRectFact3 = new Rect(0, 0, scrollRectFact3.x, factionDefSize);

            Widgets.BeginScrollView(scrollRectFact3, ref scroll2, scrollVertRectFact3);
            x = 0;
            foreach (var spawnedFaction in Find.FactionManager.AllFactionsListForReading)
            {
                if (Widgets.ButtonText(new Rect(0, x, 290, 20), spawnedFaction.Name))
                {
                    selectedFaction = spawnedFaction;
                }
                x += 22;
            }
            Widgets.EndScrollView();

            Widgets.Label(new Rect(0, 270, 290, 40), Translator.Translate("ThreatPoint"));
            Widgets.TextFieldNumeric(new Rect(300, 270, 320, 20), ref threatsFloat, ref threats, 0, 2000000);

            int  defSize            = stock.Count * 45;
            Rect scrollRectFact     = new Rect(0, 320, 620, 235);
            Rect scrollVertRectFact = new Rect(0, 0, scrollRectFact.x, defSize);

            Widgets.DrawBox(new Rect(0, 320, 620, 240));
            Widgets.BeginScrollView(scrollRectFact, ref scroll, scrollVertRectFact);
            x = 0;
            for (int i = 0; i < stock.Count; i++)
            {
                if (i >= stock.Count)
                {
                    break;
                }

                Thing good = stock[i];

                Widgets.DrawBoxSolid(new Rect(5, x, 615, 40), new Color(0, 0, 0, 0.75f));
                Widgets.Label(new Rect(5, x, 240, 40), good.Label);
                int.TryParse(Widgets.TextField(new Rect(245, x, 215, 40), good.stackCount.ToString()), out good.stackCount);
                if (Widgets.ButtonText(new Rect(510, x, 110, 40), Translator.Translate("DeleteGood")))
                {
                    DeleteGood(good);
                }
                x += 44;
            }
            Widgets.EndScrollView();

            if (Widgets.ButtonText(new Rect(0, 565, 630, 20), Translator.Translate("CreateNewItemToStash")))
            {
                editor.Show(stock);
            }

            Widgets.Label(new Rect(0, 600, 630, 20), $"Selected tile ID: {Find.WorldSelector.selectedTile}");

            if (Widgets.ButtonText(new Rect(0, 625, 630, 20), Translator.Translate("AddNewItemStash")))
            {
                AddItemStash();
            }
        }