Beispiel #1
0
 public void Close()
 {
     if (instance != null)
     {
         instance.isVisible = false;
         Destroy(instance.gameObject);
         instance = null;
     }
 }
Beispiel #2
0
        public void DestroyAssetTypePanel()
        {
            if (assetTypePanel == null)
            {
                return;
            }
            assetTypePanel.Close();
            RemoveUIComponent(assetTypePanel);
            assetTypePanel = null;

            Settings.assetTypePanelX = -80.0f;
            Settings.assetTypePanelY = -75.0f;
            XMLUtils.SaveSettings();
        }
Beispiel #3
0
 public void CreateAssetTypePanel()
 {
     if (assetTypePanel != null)
     {
         return;
     }
     assetTypePanel                  = AddUIComponent <UIAssetTypePanel>();
     assetTypePanel.atlas            = SamsamTS.UIUtils.GetAtlas("Ingame");
     assetTypePanel.backgroundSprite = "GenericTab";
     assetTypePanel.color            = new Color32(196, 200, 206, 255);
     assetTypePanel.isVisible        = false;
     assetTypePanel.size             = new Vector2(75, 145);
     assetTypePanel.relativePosition = new Vector2(Settings.assetTypePanelX, Settings.assetTypePanelY);
 }
Beispiel #4
0
        public override void Start()
        {
            instance = this;

            tooltip = Translations.Translate("FIF_ATP_TP");

            m_dragHandle                  = AddUIComponent <UIDragHandle>();
            m_dragHandle.target           = instance;
            m_dragHandle.relativePosition = Vector3.zero;
            m_dragHandle.size             = new Vector2(75, 145);

            eventPositionChanged += (c, p) =>
            {
                Settings.assetTypePanelX = relativePosition.x;
                Settings.assetTypePanelY = relativePosition.y;
                XMLUtils.SaveSettings();
            };

            toggles = new UICheckBox[8];
            for (int i = 0; i < 8; i++)
            {
                toggles[i]         = SamsamTS.UIUtils.CreateIconToggle(this, CategoryIcons.atlases[i], CategoryIcons.spriteNames[i], CategoryIcons.spriteNames[i], 0.5f, 30f);
                toggles[i].tooltip = CategoryIcons.tooltips[i];

                if (i < 4)
                {
                    toggles[i].relativePosition = new Vector3(5, 5 + 35 * i);
                }
                else
                {
                    toggles[i].relativePosition = new Vector3(40, 5 + 35 * (i - 4));
                }

                toggles[i].isChecked = true;
                toggles[i].readOnly  = true;
                toggles[i].checkedBoxObject.isInteractive = false;

                toggles[i].eventClick += (c, p) =>
                {
                    // when all tabs are checked, toggle a tab will uncheck all the other tabs
                    bool check = true;
                    for (int j = 0; j < 8; j++)
                    {
                        check = check && toggles[j].isChecked;
                    }
                    if (check)
                    {
                        for (int j = 0; j < 8; j++)
                        {
                            toggles[j].isChecked = false;
                        }
                        ((UICheckBox)c).isChecked = true;
                        SelectAssetType();
                        return;
                    }
                    // when a tab is unchecked, toggle it will uncheck all the other tabs
                    if (((UICheckBox)c).isChecked == false)
                    {
                        for (int j = 0; j < 8; j++)
                        {
                            toggles[j].isChecked = false;
                        }
                        ((UICheckBox)c).isChecked = true;
                        SelectAssetType();
                        return;
                    }

                    // when a tab is already checked, toggle it will move back to select all
                    if (((UICheckBox)c).isChecked == true)
                    {
                        for (int j = 0; j < 8; j++)
                        {
                            toggles[j].isChecked = true;
                        }

                        UISearchBox.instance.typeFilter.selectedIndex = (int)UISearchBox.DropDownOptions.All;
                        return;
                    }
                };
            }

            if (!FindIt.isRicoEnabled)
            {
                toggles[6].isVisible = false;
                toggles[7].isVisible = false;
            }
        }