Esempio n. 1
0
        public static void Load()
        {
            MainPatcher.writeDebugLine("MiniMap Load");
            MainPatcher.writeDebugLine(DateTime.Now.ToString("O"));
            var inst = new GameObject("SubnauticaMiniMap.MiniMap").AddComponent <MiniMap>();

            printOnce("MiniMap instantiated");
            try
            {
                objs.Add(inst.gameObject);
                GameObject obj = new GameObject("SubnauticaMiniMap.Overlay");
                //obj.AddComponent<UIOverlay>().color = new Color(1.0f, 0.0f, 0.0f);
                objs.Add(obj);
                inst.overlay = obj;
            }
            catch (Exception e)
            {
                printOnce("exception during MiniMap Load");
                printOnce(e.Message);
            }
            string minimapassetfile = string.Format("{0}\\QMods\\MiniMap\\subnauticaminimap", Environment.CurrentDirectory);

            printOnce(minimapassetfile);
            inst.assets = AssetBundle.LoadFromFile(minimapassetfile);
            //inst.assets = AssetBundle.LoadFromFile(@"H:\DEV\2018\UnitySubntest\SubnauticaModdingTest\Assets\AssetBundles\subnauticaminimap");
            if (inst.assets == null)
            {
                printOnce("Failed to load assets");
            }
        }
Esempio n. 2
0
        /* To keep debug messages from spamming the log this function prints every unique string only once.
         */
        public static void printOnce(string message)
        {
            bool is_new = printed.Add(message);

            if (is_new)
            {
                MainPatcher.writeDebugLine(message);
            }
        }
        protected override void OnPopulateMesh(VertexHelper vh)
        {
            if (!logged)
            {
                logged = true;
                MainPatcher.writeDebugLine("OnPopulateMesh");
            }
            Vector2 corner1 = Vector2.zero;
            Vector2 corner2 = Vector2.zero;

            corner1.x = 0.0f;
            corner1.y = 0.0f;
            corner2.x = 1.0f;
            corner2.y = 1.0f;

            corner1.x -= rectTransform.pivot.x;
            corner1.y -= rectTransform.pivot.y;
            corner2.x -= rectTransform.pivot.x;
            corner2.y -= rectTransform.pivot.y;

            corner1.x *= rectTransform.rect.width;
            corner1.y *= rectTransform.rect.height;
            corner2.x *= rectTransform.rect.width;
            corner2.y *= rectTransform.rect.height;

            vh.Clear();

            UIVertex vert = UIVertex.simpleVert;

            vert.position = new Vector2(corner1.x, corner1.y);
            vert.color    = color;
            vh.AddVert(vert);

            vert.position = new Vector2(corner1.x, corner2.y);
            vert.color    = color;
            vh.AddVert(vert);

            vert.position = new Vector2(corner2.x, corner2.y);
            vert.color    = color;
            vh.AddVert(vert);

            vert.position = new Vector2(corner2.x, corner1.y);
            vert.color    = color;
            vh.AddVert(vert);

            vh.AddTriangle(0, 1, 2);
            vh.AddTriangle(2, 3, 0);
        }
Esempio n. 4
0
 private void Awake()
 {
     MainPatcher.writeDebugLine("MiniMap Awake");
     MiniMap.Instance = this;
 }