Example #1
0
        public void Image()
        {
            Page page = new Page(sectionPath, pageTitle);

            OutlineObject outline = new OutlineObject();

            page.AddObject(outline);

            Bitmap bitmap = new Bitmap(200, 200);

            for (int y = 0; y < bitmap.Height; y++)
            {
                for (int x = 0; x < bitmap.Width; x++)
                {
                    bitmap.SetPixel(x, y, Color.FromArgb(255, 0, 128));
                }
            }

            MemoryStream stream = new MemoryStream();

            bitmap.Save(stream, ImageFormat.Bmp);

            outline.AddContent(new ImageContent(stream.ToArray()));

            XmlDocument serializedPage = new XmlDocument();

            serializedPage.LoadXml(page.ToString());
        }
Example #2
0
        public void ConstructWithHtml()
        {
            Page page = new Page(sectionPath, pageTitle, "hello world");

            OutlineObject outline      = null;
            int           cPageObjects = 0;

            foreach (PageObject pageObject in page)
            {
                outline = (OutlineObject)pageObject;
                cPageObjects++;
            }

            Assert.AreEqual(1, cPageObjects);

            HtmlContent content  = null;
            int         cContent = 0;

            foreach (OutlineContent outlineContent in outline)
            {
                content = (HtmlContent)outlineContent;
                cContent++;
            }

            Assert.AreEqual(1, cPageObjects);

            Assert.AreEqual(content.HtmlData, "hello world");
        }
Example #3
0
 // Use this for initialization
 void Start()
 {
     inRangeHumanoids = new HashSet <Humanoid> ();
     raycastTimer     = new CounterTimer(raycastInterval);
     mesh.enabled     = false;
     outline          = GetComponent <OutlineObject> ();
 }
Example #4
0
        private void DoExportItem(XPathNavigator nav)
        {
            // Create a new page in the section "General", with the
            // title from the item:
            string title = StripAndDecode(nav.Evaluate("string(//item/title/text())").ToString());
            Page   p     = new Page(configInfo.Page, title);

            p.Date = DateTime.Parse(nav.Evaluate("string(//item/pubDate/text())").ToString());

            // Create a new Outline, and add some content to it:
            OutlineObject outline = new OutlineObject();

            if (configInfo.ItemLinkBelowContent)
            {
                outline.AddContent(new HtmlContent(String.Format(configInfo.ItemContentTemplate, nav.Evaluate("string(//item/description/text())").ToString())));
                outline.AddContent(new HtmlContent(String.Format(configInfo.ItemLinkTemplate, nav.Evaluate("string(//item/link/text())").ToString())));
            }
            else
            {
                outline.AddContent(new HtmlContent(String.Format(configInfo.ItemLinkTemplate, nav.Evaluate("string(//item/link/text())").ToString())));
                outline.AddContent(new HtmlContent(String.Format(configInfo.ItemContentTemplate, nav.Evaluate("string(//item/description/text())").ToString())));
            }
            // Add the outline to our page:
            p.AddObject(outline);
            // Commit the changes to OneNote, and set the actively viewed page:
            p.Commit();
            p.NavigateTo();
        }
Example #5
0
 public void Regist(OutlineObject obj)
 {
     if (obj != null && !objs.Contains(obj))
     {
         objs.Add(obj);
     }
 }
Example #6
0
 void SetOutLine(Transform target)
 {
     if (!target)
     {
         if (_outline)
         {
             Destroy(_outline);
         }
         _outline = null;
     }
     else
     {
         if (_outline)
         {
             if (_outline.transform == target)
             {
                 return;
             }
             Destroy(_outline);
         }
         _outline          = target.gameObject.AddComponent <OutlineObject>();
         _outline.color    = outlineColor1;
         _outlineStartTime = 0f;
     }
 }
Example #7
0
        public void Serialization()
        {
            Page page = new Page(sectionPath);

            string      htmlString  = "<html><body><p>hello world</p></body></html>";
            HtmlContent htmlContent = new HtmlContent(htmlString);

            OutlineObject outlineObject = new OutlineObject();

            outlineObject.AddContent(htmlContent);

            page.AddObject(outlineObject);

            IFormatter formatter  = new BinaryFormatter();
            Stream     serialized = new MemoryStream();

            formatter.Serialize(serialized, page);

            serialized.Seek(0, SeekOrigin.Begin);
            Page deserialized = (Page)formatter.Deserialize(serialized);

            serialized.Close();

            Assert.AreEqual(page, deserialized);
            Assert.AreEqual(page.ToString(), deserialized.ToString());
        }
Example #8
0
        private void SendToOneNote(byte[] imageData, string title)
        {
            Page          page1    = new Page("Side Notes.one", title);
            OutlineObject obj1     = new OutlineObject();
            ImageContent  content1 = new ImageContent(imageData);
            HtmlContent   content2 = new HtmlContent("<font size=small>Capture taken at " + DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString() + "</font>");

            obj1.AddContent(content1);
            obj1.AddContent(content2);
            page1.AddObject(obj1);
            page1.Commit();
            page1.NavigateTo();
        }
    public void RemoveOutlineObject(OutlineObject obj)
    {
        obj.Outline = false;
        if (activeObjects != null)
        {
            activeObjects.Remove(obj);
        }

        if (inactiveObjects != null)
        {
            inactiveObjects.Remove(obj);
        }
    }
    //Init Event
    protected void Awake()
    {
        gameObject.tag = "Interact";
        outline        = gameObject.AddComponent <OutlineObject>();
        sr             = gameObject.GetComponent <SpriteRenderer>();
        if (gameObject.GetComponent <Collider2D>() != null)
        {
            col = gameObject.GetComponent <PolygonCollider2D>();
        }
        else
        {
            col = gameObject.AddComponent <PolygonCollider2D>();
        }

        init();
    }
Example #11
0
    void DrawSubmesh(OutlineObject obj, int subMeshIndex, Material mat)
    {
        #if UNITY_2018
        subMeshIndex += obj.subMeshIndex;
        #endif

        int pass = obj._transparent ? 0 : obj._occlusion ? 0 : 1;
        // draw depth mask
        buffer.SetRenderTarget(depthMaskID, BuiltinRenderTextureType.ResolvedDepth);//grab depth
        buffer.DrawRenderer(obj.renderer, mat, subMeshIndex, pass);
        if (occlusionCullModeOn)
        {
            //draw non depth mask
            buffer.SetRenderTarget(maskID, BuiltinRenderTextureType.ResolvedDepth);//grab depth
            buffer.DrawRenderer(obj.renderer, mat, subMeshIndex, obj._transparent ? 0 : obj._occlusionCull ? 1:0);
        }
    }
Example #12
0
 void RevertMat()
 {
     if (Valid && !m_Loading)
     {
         m_MeshMgr.m_MeshMat = m_CreationData.m_MeshMgr.m_MeshMat;
         m_MeshMgr.SetMeshMat(m_MeshMgr.m_MeshMat);
         OutlineObject oo = VCUtils.GetComponentOrOnParent <OutlineObject>(this.gameObject);
         if (oo != null)
         {
             oo.ReplaceInCache(VCEditor.Instance.m_HolographicMat, m_MeshMgr.m_MeshMat);
         }
         if (OnLoadMeshComplete != null)
         {
             OnLoadMeshComplete();
         }
     }
 }
Example #13
0
    public virtual void LevelUp()
    {
        if (!CheckIfItsAvailable())
        {
            return;
        }

        OutlineObject oo = GetCurrentTower().GetComponent <OutlineObject>();

        if (oo != null)
        {
            Color mix = (4 * oo.GetCurrentColor() + 1 * oo.GetGlowColor()) / 5;
            oo.SetCurrentColor(mix);
        }

        // Set childs callables
        foreach (Perk p in childs)
        {
            p.TurnCallable();
            p.GetButton().interactable = true;
        }

        // Upgrade perk
        level++;

        // Upgrade stats
        Text[] aux = gameObject.GetComponentsInChildren <Text>();

        foreach (Text t in aux)
        {
            if (t.gameObject.name == "Level")
            {
                t.text = "Level: " + level.ToString() + "/" + maxLevel.ToString();
            }
        }

        // Consume souls to level up
        soulsCounter.SetSouls(soulsCounter.GetSouls() - cost);

        // Add score
        scoreCounter.SetScore(scoreCounter.GetScore() + addScore);

        // Call a default function on skill gameObject to alter values
        Debug.Log(name + " level up to level " + level + " on tower " + GetCurrentTower().name);
    }
Example #14
0
    protected virtual void SetPickState(bool isOver)
    {
        OutlineObject outLine = GetComponent <OutlineObject>();

        if (null == outLine)
        {
            return;
        }

        if (isOver)
        {
            outLine.color = new Color(0, 0.5f, 1f, 1f);
        }
        else
        {
            Destroy(outLine);
        }
    }
Example #15
0
    public void Start()
    {
        outline    = GetComponent <OutlineObject>();
        photonView = GetComponent <PhotonView>();

        // Create orders canvas
        orderCanvas_obj      = new GameObject();
        orderCanvas_obj.name = "orderCanvas";
        orderCanvas          = orderCanvas_obj.gameObject.AddComponent <Canvas>();
        orderCanvas_obj.transform.SetParent(this.gameObject.transform);
        orderCanvas.renderMode = RenderMode.WorldSpace;
        RectTransform rectTransform = orderCanvas_obj.GetComponent <RectTransform>();

        rectTransform.localPosition = new Vector3(0, 1f, 0);
        rectTransform.localRotation = Quaternion.Euler(90, 0, 0);
        rectTransform.sizeDelta     = new Vector2(1, 1);


        moveOrder = new GameObject();
        setOrderImage(moveOrder, "moveOrder", "Orders/move", ref moveOrderImage, ref moveOrderScript);

        entrenOrder = new GameObject();
        setOrderImage(entrenOrder, "entrenOrder", "Orders/entrenchment", ref entrenOrderImage, ref entrenOrderScript);

        guerrillaOrder = new GameObject();
        setOrderImage(guerrillaOrder, "guerrillaOrder", "Orders/guerrilla", ref guerrillaOrderImage, ref guerrillaOrderScript);

        adminOrder = new GameObject();
        setOrderImage(adminOrder, "adminOrder", "Orders/administration", ref adminOrderImage, ref adminOrderScript);

        hiddenOrder = new GameObject();
        setOrderImage(hiddenOrder, "hiddenOrder", "Order/hiddenOrder", ref hiddenOrderImage, ref hiddenOrderScript);

        CleanCanvasOrder();

        // Get resources sprite
        resourcesCanvas_obj    = this.gameObject.transform.Find("Canvas").gameObject;
        foodResources_obj      = resourcesCanvas_obj.transform.Find("Food").gameObject;
        strategicResources_obj = resourcesCanvas_obj.transform.Find("Strategic").gameObject;
        goldResources_obj      = resourcesCanvas_obj.transform.Find("Gold").gameObject;
        SetResourcesSprite();
    }
Example #16
0
            private void PostItem(string html, bool isHtml, string name)
            {
                try
                {
                    Page          p       = new Page("General.one", "Import from " + Core.ProductFullName + ": " + name);
                    OutlineObject outline = new OutlineObject();

                    if (!isHtml)
                    {
                        html = HttpUtility.HtmlEncode(html);
                    }

                    outline.AddContent(new HtmlContent(html));
                    p.AddObject(outline);
                    p.Commit();
                    p.NavigateTo();
                }
                catch
                {
                    Core.UIManager.QueueUIJob(new ErrorReportJob(ReportError), new object[] { "Can not create OneNote post. Is OneNote installed?" });
                }
            }
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        EditorGUILayout.Space();

        GUIStyle hr = new GUIStyle(GUI.skin.box);

        hr.border.top    = 0;
        hr.border.bottom = 0;
        hr.margin.top    = 0;
        hr.margin.bottom = 8;
        hr.stretchWidth  = true;
        hr.fixedHeight   = 1;

        Color originalColor = GUI.color;

        GUI.color = Color.black;
        GUILayout.Box("", hr);
        GUI.color = originalColor;

        GUILayout.Label("Outline Actions:");

        if (GUILayout.Button("Regenerate"))
        {
            OutlineObject outline = (OutlineObject)target;
            outline.Regenerate();
        }

        if (GUILayout.Button("Clear"))
        {
            OutlineObject outline = (OutlineObject)target;
            outline.Clear();
        }

        EditorGUILayout.Space();
    }
Example #18
0
        public void Text()
        {
            Page page = new Page(sectionPath);

            string      htmlString  = "hello world";
            HtmlContent htmlContent = new HtmlContent(htmlString);

            Assert.IsNotNull(htmlContent.HtmlData);
            OutlineObject outlineObject = new OutlineObject();

            outlineObject.AddContent(htmlContent);

            page.AddObject(outlineObject);

            XmlDocument serializedPage = new XmlDocument();

            serializedPage.LoadXml(page.ToString());

            XmlElement import = serializedPage.DocumentElement;

            string validHtml = "<html><body>" + htmlString + "</body></html>";

            Assert.AreEqual(validHtml, import.InnerText);
        }
Example #19
0
        public void Html()
        {
            Page page = new Page(sectionPath);

            string      htmlString  = "<html><body><p>hello world</p></body></html>";
            HtmlContent htmlContent = new HtmlContent(htmlString);

            Assert.IsNotNull(htmlContent.HtmlData);

            OutlineObject outlineObject = new OutlineObject();

            outlineObject.AddContent(htmlContent);

            int cContent = 0;

            foreach (OutlineContent content in outlineObject)
            {
                Assert.AreSame(htmlContent, content);
                cContent++;
            }
            Assert.IsTrue(cContent == 1);

            page.AddObject(outlineObject);

            int cObjects = 0;

            foreach (PageObject pageObject in page)
            {
                Assert.AreSame(outlineObject, pageObject);
                cObjects++;
            }
            Assert.IsTrue(cObjects == 1);

            XmlDocument serializedPage = new XmlDocument();

            serializedPage.LoadXml(page.ToString());

            XmlElement import = serializedPage.DocumentElement;

            Assert.IsTrue(import.ChildNodes.Count == 2);

            XmlElement placeObjectsVerb = (XmlElement)import.ChildNodes.Item(1);

            Assert.IsTrue(placeObjectsVerb.ChildNodes.Count == 1);

            XmlElement objectElement = (XmlElement)placeObjectsVerb.ChildNodes.Item(0);

            Assert.IsTrue(objectElement.ChildNodes.Count == 2);

            XmlElement positionElement = (XmlElement)objectElement.ChildNodes.Item(0);

            Assert.AreEqual(positionElement.GetAttribute("x"), outlineObject.Position.X.ToString());
            Assert.AreEqual(positionElement.GetAttribute("y"), outlineObject.Position.Y.ToString());

            XmlElement outlineElement = (XmlElement)objectElement.ChildNodes.Item(1);

            Assert.IsTrue(outlineElement.ChildNodes.Count == 1);

            XmlElement htmlElement = (XmlElement)outlineElement.ChildNodes.Item(0);
            XmlElement dataElement = (XmlElement)htmlElement.ChildNodes.Item(0);

            Assert.AreEqual(htmlString, dataElement.InnerText);
        }