예제 #1
0
        private void CreateRemoveUndesiredModelsButton()
        {
            KlyteMonoUtils.CreateUIElement <UIButton>(out UIButton removeUndesired, MainPanel.transform);
            removeUndesired.relativePosition = new Vector3(MainPanel.width - 25f, 0f);
            removeUndesired.textScale        = 0.6f;
            removeUndesired.width            = 20;
            removeUndesired.height           = 20;
            removeUndesired.tooltip          = Locale.Get("K45_TLM_REMOVE_UNWANTED_TOOLTIP");
            KlyteMonoUtils.InitButton(removeUndesired, true, "ButtonMenu");
            removeUndesired.name        = "DeleteLineButton";
            removeUndesired.isVisible   = true;
            removeUndesired.eventClick += (component, eventParam) =>
            {
                TLMLineUtils.RemoveAllUnwantedVehicles();
            };

            UISprite icon = removeUndesired.AddUIComponent <UISprite>();

            icon.relativePosition = new Vector3(2, 2);
            icon.width            = 18;
            icon.height           = 18;
            icon.spriteName       = KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_RemoveUnwantedIcon);
        }