private void AddScreenshot()
        {
            var group = ComponentPool.Get <PropertyGroupPanel>(ContentPanel);
            var info  = ComponentPool.Get <IntersectionTemplateInfoProperty>(group);

            info.Init(EditObject);
        }
    private void Start()
    {
        audioSourcePool    = new ComponentPool <AudioSource>(audioSourceObject, numberOfpooledObjects, this.transform);
        activeAudioSources = new LinkedList <AudioSource>();

        bgm.Init();
        notes.Init();
        notes.useSoundEffectVolume = true;

        /*
         * bgm = new AudioSourceBuffer();
         * bgm.Loop = true;
         * bgm.AllowSameClip = false;
         * bgm.fullFadeInDuration = 1;
         * bgm.fullFadeOutDuration = 0.4f;
         * bgm.partialFadeInDuration = 0.5f;
         * bgm.partialFadeOutDuration = 0.5f;
         *
         * notes = new AudioSourceBuffer();
         * notes.Loop = false;
         * notes.fullFadeOutDuration = 0.3f;
         */
        oneShotSource = audioSourcePool.Get();
        ResetAudioSource(oneShotSource);

        SetBGMVolume(bgmVolume);
        SetSoundEffectVolume(soundEffectVolume);
        SetMasterVolume(masterVolume);
    }
Exemple #3
0
        private void AddLineProperties(MarkupLine editObject)
        {
            LineProperties = ComponentPool.Get <PropertyGroupPanel>(ContentPanel.Content);
            LineProperties.Init();

            if (editObject is MarkupRegularLine line)
            {
                var aligment     = AddAlignmentProperty(line.RawAlignment, NodeMarkup.Localize.LineEditor_LineAlignment);
                var clipSidewalk = AddClipSidewalkProperty(line);
                LinePropertiesVisibleAction = () =>
                {
                    clipSidewalk.isVisible   = line.PointPair.NetworkType == NetworkType.Road;
                    aligment.isVisible       = IsSplit;
                    LineProperties.isVisible = clipSidewalk.isVisibleSelf || aligment.isVisibleSelf;
                };
            }
            else if (editObject is MarkupStopLine stopLine)
            {
                var start = AddAlignmentProperty(stopLine.RawStartAlignment, NodeMarkup.Localize.LineEditor_LineStartAlignment);
                var end   = AddAlignmentProperty(stopLine.RawEndAlignment, NodeMarkup.Localize.LineEditor_LineEndAlignment);
                LinePropertiesVisibleAction = () =>
                {
                    start.isVisible          = stopLine.Start.IsSplit;
                    end.isVisible            = stopLine.End.IsSplit;
                    LineProperties.isVisible = start.isVisibleSelf || end.isVisibleSelf;
                };
            }

            SetLinePropertiesVisible();
        }
        public override void SetCraftingBlueprint(CraftingBlueprint blueprint)
        {
            base.SetCraftingBlueprint(blueprint);

            if (window.isVisible == false)
            {
                return;
            }

            blueprintRequiredItemsPool.DestroyAll();
            foreach (var item in blueprint.requiredItems)
            {
                var ui = blueprintRequiredItemsPool.Get();
                item.item.currentStackSize = (uint)item.amount;
                ui.transform.SetParent(blueprintRequiredItemsContainer);
                InventoryUtility.ResetTransform(ui.transform);

                ui.item = item.item;
                if (InventoryManager.GetItemCount(item.item.ID, currentCategory.alsoScanBankForRequiredItems) >= item.amount)
                {
                    ui.icon.color = itemsAvailableColor;
                }
                else
                {
                    ui.icon.color = itemsNotAvailableColor;
                }

                ui.Repaint();
                item.item.currentStackSize = 1; // Reset
            }
        }
Exemple #5
0
 private void AddSplit(MarkupEnterPoint point)
 {
     Split      = ComponentPool.Get <BoolListPropertyPanel>(PropertiesPanel, nameof(Split));
     Split.Text = NodeMarkup.Localize.PointEditor_SplitIntoTwo;
     Split.Init(NodeMarkup.Localize.StyleOption_No, NodeMarkup.Localize.StyleOption_Yes);
     Split.SelectedObject         = point.Split;
     Split.OnSelectObjectChanged += SplitChanged;
 }
 private void AddStyleTypeProperty()
 {
     Style      = ComponentPool.Get <FillerStylePropertyPanel>(PropertiesPanel);
     Style.Text = NodeMarkup.Localize.Editor_Style;
     Style.Init();
     Style.SelectedObject         = EditObject.Style.Type;
     Style.OnSelectObjectChanged += StyleChanged;
 }
 private void AddStyleTypeProperty()
 {
     Style      = ComponentPool.Get <CrosswalkPropertyPanel>(PropertiesPanel, nameof(Style));
     Style.Text = NodeMarkup.Localize.Editor_Style;
     Style.Init();
     Style.SelectedObject         = EditObject.Style.Value.Type;
     Style.OnSelectObjectChanged += StyleChanged;
 }
Exemple #8
0
 private void AddAddButton()
 {
     AddButton      = ComponentPool.Get <AddRuleButton>(ContentPanel.Content);
     AddButton.Text = NodeMarkup.Localize.LineEditor_AddRuleButton;
     AddButton.Init();
     AddButton.OnButtonClick += AddRule;
     SetAddButtonVisible();
 }
        private RulePanel AddRulePanel(MarkupLineRawRule rule)
        {
            var rulePanel = ComponentPool.Get <RulePanel>(ContentPanel);

            rulePanel.Init(this, rule);
            rulePanel.OnHover += RuleMouseHover;
            rulePanel.OnEnter += RuleMouseLeave;
            return(rulePanel);
        }
        private void AddHeader()
        {
            var header = ComponentPool.Get <StyleHeaderPanel>(PropertiesPanel);

            header.Init(Manager.Style.StyleType.Filler, OnSelectTemplate, false);
            header.OnSaveTemplate += OnSaveTemplate;
            header.OnCopy         += CopyStyle;
            header.OnPaste        += PasteStyle;
        }
Exemple #11
0
 private void AddHeader()
 {
     Header = ComponentPool.Get <StyleHeaderPanel>(this, nameof(Header));
     Header.Init(Rule.Style.Value.Type, OnSelectTemplate, Line.IsSupportRules);
     Header.OnDelete       += () => Editor.DeleteRule(this);
     Header.OnSaveTemplate += OnSaveTemplate;
     Header.OnCopy         += CopyStyle;
     Header.OnPaste        += PasteStyle;
 }
Exemple #12
0
        protected ButtonPanel AddInvertProperty(UIComponent parent)
        {
            var buttonsPanel = ComponentPool.Get <ButtonPanel>(parent, nameof(Invert));

            buttonsPanel.Text = Localize.StyleOption_Invert;
            buttonsPanel.Init();

            return(buttonsPanel);
        }
Exemple #13
0
 protected virtual void AddHeader()
 {
     HeaderPanel = ComponentPool.Get <HeaderPanelType>(PropertiesPanel);
     HeaderPanel.Init(EditObject);
     HeaderPanel.OnSaveAsset += SaveAsset;
     HeaderPanel.OnEdit      += StartEditTemplate;
     HeaderPanel.OnSave      += SaveChanges;
     HeaderPanel.OnNotSave   += NotSaveChanges;
 }
Exemple #14
0
        protected override void OnObjectSelect(MarkupEnterPoint point)
        {
            base.OnObjectSelect(point);

            TemplatePanel = ComponentPool.Get <PropertyGroupPanel>(ContentPanel.Content);
            TemplatePanel.StopLayout();
            FillTemplatePanel(point);
            TemplatePanel.StartLayout();
            TemplatePanel.Init();
        }
 protected override void OnObjectSelect()
 {
     Offset           = ComponentPool.Get <FloatPropertyPanel>(PropertiesPanel);
     Offset.Text      = NodeMarkup.Localize.PointEditor_Offset;
     Offset.UseWheel  = true;
     Offset.WheelStep = 0.1f;
     Offset.Init();
     Offset.Value           = EditObject.Offset;
     Offset.OnValueChanged += OffsetChanged;
 }
        private void AddHeader()
        {
            var header = ComponentPool.Get <CrosswalkHeaderPanel>(PropertiesPanel, "Header");

            header.Init(EditObject.Style.Value.Type, SelectTemplate, false);
            header.OnSaveTemplate += SaveTemplate;
            header.OnCopy         += CopyStyle;
            header.OnPaste        += PasteStyle;
            header.OnCut          += CutLines;
        }
Exemple #17
0
        protected BoolListPropertyPanel AddCenterSolidProperty(UIComponent parent)
        {
            var centerSolidProperty = ComponentPool.Get <BoolListPropertyPanel>(parent, nameof(CenterSolid));

            centerSolidProperty.Text = Localize.StyleOption_SolidInCenter;
            centerSolidProperty.Init(Localize.StyleOption_No, Localize.StyleOption_Yes);
            centerSolidProperty.SelectedObject         = CenterSolid;
            centerSolidProperty.OnSelectObjectChanged += (value) => CenterSolid.Value = value;
            return(centerSolidProperty);
        }
Exemple #18
0
        protected LineAlignmentPropertyPanel AddAlignmentProperty(IDoubleAlignmentLine alignmentStyle, UIComponent parent)
        {
            var alignmentProperty = ComponentPool.Get <LineAlignmentPropertyPanel>(parent, nameof(alignmentStyle.Alignment));

            alignmentProperty.Text = Localize.StyleOption_Alignment;
            alignmentProperty.Init();
            alignmentProperty.SelectedObject         = alignmentStyle.Alignment;
            alignmentProperty.OnSelectObjectChanged += (value) => alignmentStyle.Alignment.Value = value;
            return(alignmentProperty);
        }
Exemple #19
0
        private void AddRoad(MarkupEnterPoint point)
        {
            var roadNameProperty = ComponentPool.Get <StringPropertyPanel>(TemplatePanel, "Road");

            roadNameProperty.Text          = NodeMarkup.Localize.PointEditor_RoadName;
            roadNameProperty.FieldWidth    = 230;
            roadNameProperty.EnableControl = false;
            roadNameProperty.Init();
            roadNameProperty.Value = point.Enter.GetSegment().Info.name;
        }
        protected BoolListPropertyPanel AddFollowRailsProperty(IFollowRailFiller followRailStyle, UIComponent parent)
        {
            var followRailsProperty = ComponentPool.Get <BoolListPropertyPanel>(parent, nameof(followRailStyle.FollowRails));

            followRailsProperty.Text = Localize.StyleOption_FollowRails;
            followRailsProperty.Init(Localize.StyleOption_No, Localize.StyleOption_Yes);
            followRailsProperty.SelectedObject         = followRailStyle.FollowRails;
            followRailsProperty.OnSelectObjectChanged += (bool value) => followRailStyle.FollowRails.Value = value;
            return(followRailsProperty);
        }
Exemple #21
0
 private void AddAddButton()
 {
     if (AddRuleAvailable)
     {
         AddButton      = ComponentPool.Get <ButtonPanel>(ContentPanel);
         AddButton.Text = NodeMarkup.Localize.LineEditor_AddRuleButton;
         AddButton.Init();
         AddButton.OnButtonClick += AddRule;
     }
 }
 private void AddTemplateName()
 {
     NameProperty                   = ComponentPool.Get <StringPropertyPanel>(PropertiesPanel, "Name");
     NameProperty.Text              = NodeMarkup.Localize.TemplateEditor_Name;
     NameProperty.FieldWidth        = 230;
     NameProperty.SubmitOnFocusLost = true;
     NameProperty.Init();
     NameProperty.Value           = EditObject.Name;
     NameProperty.OnValueChanged += (name) => OnChanged();
 }
Exemple #23
0
        private LineAlignmentPropertyPanel AddAlignmentProperty(PropertyEnumValue <Alignment> property, string label)
        {
            var alignment = ComponentPool.Get <LineAlignmentPropertyPanel>(LineProperties, "LineAlignment");

            alignment.Text = label;
            alignment.Init();
            alignment.SelectedObject         = property;
            alignment.OnSelectObjectChanged += (value) => property.Value = value;

            return(alignment);
        }
Exemple #24
0
 private void AddOffset(MarkupEnterPoint point)
 {
     Offset           = ComponentPool.Get <FloatPropertyPanel>(PropertiesPanel, nameof(Offset));
     Offset.Text      = NodeMarkup.Localize.PointEditor_Offset;
     Offset.UseWheel  = true;
     Offset.WheelStep = 0.1f;
     Offset.WheelTip  = WheelTip;
     Offset.Init();
     Offset.Value           = point.Offset;
     Offset.OnValueChanged += OffsetChanged;
 }
        protected BoolListPropertyPanel AddUseGapProperty(UIComponent parent)
        {
            var useGapProperty = ComponentPool.Get <BoolListPropertyPanel>(parent, nameof(UseGap));

            useGapProperty.Text = Localize.StyleOption_UseGap;
            useGapProperty.Init();
            useGapProperty.SelectedObject         = UseGap;
            useGapProperty.OnSelectObjectChanged += (value) => UseGap.Value = value;

            return(useGapProperty);
        }
        protected override void OnObjectSelect(IntersectionTemplate editObject)
        {
            base.OnObjectSelect(editObject);

            ItemsPanel.RemovePreview();

            Screenshot = ComponentPool.Get <PropertyGroupPanel>(ContentPanel.Content, nameof(Screenshot));
            var info = ComponentPool.Get <IntersectionTemplateInfoProperty>(Screenshot, "Info");

            info.Init(EditObject);
        }
Exemple #27
0
        private BoolListPropertyPanel AddClipSidewalkProperty(MarkupRegularLine line)
        {
            var clipSidewalk = ComponentPool.Get <BoolListPropertyPanel>(LineProperties, nameof(line.ClipSidewalk));

            clipSidewalk.Text = NodeMarkup.Localize.LineEditor_ClipSidewalk;
            clipSidewalk.Init(NodeMarkup.Localize.StyleOption_No, NodeMarkup.Localize.StyleOption_Yes);
            clipSidewalk.SelectedObject         = line.ClipSidewalk;
            clipSidewalk.OnSelectObjectChanged += (value) => line.ClipSidewalk.Value = value;

            return(clipSidewalk);
        }
Exemple #28
0
        protected BoolListPropertyPanel AddParallelProperty(IParallel parallelStyle, UIComponent parent)
        {
            var parallelProperty = ComponentPool.Get <BoolListPropertyPanel>(parent, nameof(parallelStyle.Parallel));

            parallelProperty.Text = Localize.StyleOption_ParallelToLanes;
            parallelProperty.Init(Localize.StyleOption_No, Localize.StyleOption_Yes);
            parallelProperty.SelectedObject         = parallelStyle.Parallel;
            parallelProperty.OnSelectObjectChanged += (value) => parallelStyle.Parallel.Value = value;

            return(parallelProperty);
        }
        protected sealed override EditorItem AddPrefabProperty(UIComponent parent)
        {
            var prefabProperty = ComponentPool.Get <SelectTreeProperty>(parent, nameof(Prefab));

            prefabProperty.Text = Localize.StyleOption_AssetTree;
            prefabProperty.Init(60f);
            prefabProperty.Prefab          = Prefab;
            prefabProperty.OnValueChanged += (TreeInfo value) => Prefab.Value = value;

            return(prefabProperty);
        }
 private void AddAuthor()
 {
     if (EditObject.IsAsset)
     {
         var authorProperty = ComponentPool.Get <StringPropertyPanel>(PropertiesPanel, "Author");
         authorProperty.Text          = NodeMarkup.Localize.TemplateEditor_Author;
         authorProperty.FieldWidth    = 230;
         authorProperty.EnableControl = false;
         authorProperty.Init();
         authorProperty.Value = EditObject.Asset.Author;
     }
 }