Beispiel #1
0
 public static GOFactory getInstance()
 {
     if (GOFactory.instance == null)
     {
         GOFactory.instance = new GOFactory();
     }
     return(GOFactory.instance);
 }
Beispiel #2
0
 // Use this for initialization
 void Start()
 {
     // Set up the shit...
     Engine.instance = this;
     //world = World.getInstance();
     sceneManager = SceneManager.getInstance();
     objFactory   = GOFactory.getInstance();
 }
    private IEnumerator ReloadCoroutine(GOFactory factory)
    {
        while (true)
        {
            yield return(new WaitForSeconds(factory.runEverySeconds));

            GameObject go = GameObject.Instantiate <GameObject>(factory.productPrefab);
            go.transform.position = factory.transform.position;
            GameObjectManager.bind(go);
        }
    }
 internal void Awake()
 {
     this.material = new Material(Shader.Find("Unlit/Texture"));
     this.lines    = new LineRenderer[LINE_COUNT];
     for (var i = 0; i < LINE_COUNT; i++)
     {
         GOFactory.CreateObject($"line{i}", this.gameObject.transform, out LineRenderer r);
         r.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
         r.receiveShadows    = false;
         r.useWorldSpace     = false;
         r.positionCount     = 2;
         r.startWidth        = 0.005f;
         r.endWidth          = 0.005f;
         r.material          = this.material;
         r.enabled           = true;
         this.lines[i]       = r;
     }
 }
Beispiel #5
0
        private static void CreateNotification()
        {
            UpdateNotification = UIManager.CreatePanel("UpdateNotification", UIManager.CanvasRoot.transform, out var content,
                                                       color: new Color(160 / 255f, 160 / 255f, 160 / 255f));

            UpdateNotification.SetActive(false);
            var panelTransform = UpdateNotification.GetComponent <RectTransform>();

            const float width  = 0.125f;
            const float height = 0.1f;

            panelTransform.anchorMin = new Vector2(0.5f - width, 0.5f - height);
            panelTransform.anchorMax = new Vector2(0.5f + width, 0.5f + height);

            // Title bar
            UIManager.CreateTitleBar($"<b>{QoLFixPlugin.ModName}</b> - Update available!", content.transform, out _,
                                     color: new Color(60 / 255f, 60 / 255f, 60 / 255f));

            // Viewport
            var viewport    = UIManager.CreateViewport(content.transform);
            var viewportImg = viewport.AddComponent <Image>();

            viewportImg.color = new Color(44f / 255f, 44f / 255f, 44f / 255f);

            // MessageBox
            var msgBox = GOFactory.CreateObject("MessageBox", viewport.transform,
                                                out VerticalLayoutGroup msgBoxGroup);

            msgBoxGroup.childAlignment         = TextAnchor.UpperLeft;
            msgBoxGroup.childControlHeight     = true;
            msgBoxGroup.childControlWidth      = true;
            msgBoxGroup.childForceExpandHeight = false;
            msgBoxGroup.childForceExpandWidth  = true;
            msgBoxGroup.padding = new RectOffset(3, 3, 3, 3);

            // Message
            var msg = GOFactory.CreateObject("Message", msgBox.transform,
                                             out VerticalLayoutGroup msgGroup,
                                             out LayoutElement msgLayout);

            msgGroup.padding         = new RectOffset(6, 6, 6, 12);
            msgLayout.flexibleHeight = 5000;

            // Message text
            GOFactory.CreateObject("Text", msg.transform, out UpdateText);

            UpdateText.font            = UIManager.DefaultFont;
            UpdateText.alignment       = TextAnchor.MiddleCenter;
            UpdateText.supportRichText = true;
            UpdateText.text            = GetUpdateMessage();
            UpdateText.fontSize        = 15;

            // Buttons
            var buttons = GOFactory.CreateObject("ButtonGroup", msgBox.transform,
                                                 out HorizontalLayoutGroup buttonGroup,
                                                 out LayoutElement buttonLayout);

            buttonGroup.childAlignment         = TextAnchor.UpperLeft;
            buttonGroup.childControlHeight     = true;
            buttonGroup.childControlWidth      = true;
            buttonGroup.childForceExpandHeight = true;
            buttonGroup.childForceExpandWidth  = true;
            buttonGroup.spacing         = 3;
            buttonLayout.minHeight      = 30;
            buttonLayout.flexibleHeight = 1;

            UIManager.CreateButton("Yes", buttons.transform, out _,
                                   normalColor: Color.green.RGBMultiplied(0.7f),
                                   pressedColor: Color.green.RGBMultiplied(0.5f),
                                   highlightedColor: Color.green.RGBMultiplied(0.8f),
                                   callback: () =>
            {
                UpdateManager.OpenReleasePage();
                UIManager.UnlockCursor = false;
                SetNotificationVisibility(false);
                Application.Quit();
            });
            UIManager.CreateButton("Not now", buttons.transform, out _,
                                   callback: () =>
            {
                UIManager.UnlockCursor = false;
                SetNotificationVisibility(false);
            });
        }