Example #1
0
    /// <summary>
    /// Returns a mostly-deep copy of the passed CSSItem.
    /// </summary>
    public static CSSItem Copy(CSSItem original)
    {
        //CSSItem itemCopy =            MonoBehaviour.Instantiate<CSSItem>(original);
        CSSItem itemCopy = ScriptableObject.CreateInstance <CSSItem>();

        CopyBaseAttributes(original, itemCopy);
        CopyCSSItemAttributes(original, itemCopy);

        return(itemCopy);
    }
    public void UseItemOnPlayer()
    {
        // Find the copy of the item, and use it
        CSSItem itemCopy = inventory.Find((CSSItem item) => item.name == this.item.name);

        if (itemCopy != null)
        {
            itemCopy.UseOn(player);
            Debug.Log("Used " + itemCopy.name + " on " + player.name + "!");
        }
        else
        {
            string format  = "Couldn't find a {0} in {1}'s inventory!";
            string message = string.Format(format, item.name, player.name);
            Debug.LogWarning(message);
        }
    }
Example #3
0
        private void InitOverrides()
        {
            CSSTemplateItem cssTemplate = PageItem.InnerItem;

            string cssInsert = "<link href=\"{0}\" rel=\"stylesheet\" />";
            var    css       = this.FindControl("headerSectionCSS") as Literal;

            if (css != null && cssTemplate != null && cssTemplate.CSSInclude.ListItems.Count > 0)
            {
                foreach (var item in cssTemplate.CSSInclude.ListItems)
                {
                    CSSItem cssItem = item;

                    if (cssItem != null && !string.IsNullOrEmpty(cssItem.CSSFilename.Text) && !string.IsNullOrEmpty(cssItem.CSSFilepath.Text))
                    {
                        css.Text += string.Format(cssInsert, cssItem.CSSFilepath.Text + cssItem.CSSFilename.Text);
                    }
                }
            }

            JSTemplateItem jsTemplate = PageItem.InnerItem;

            string jsInsert = "<script src=\"{0}\"></script>";
            var    js       = this.FindControl("footerSectionJS") as Literal;

            if (js != null && jsTemplate != null && jsTemplate.JSInclude.ListItems.Count > 0)
            {
                foreach (var item in jsTemplate.JSInclude.ListItems)
                {
                    JSItem jsItem = item;

                    if (jsItem != null && !string.IsNullOrEmpty(jsItem.JSFilename.Text) && !string.IsNullOrEmpty(jsItem.JSFilepath.Text))
                    {
                        js.Text += string.Format(jsInsert, jsItem.JSFilepath.Text + jsItem.JSFilename.Text);
                    }
                }
            }
        }
Example #4
0
 protected static void CopyCSSItemAttributes(CSSItem from, CSSItem to)
 {
     to.activeEffects  = from.activeEffects;
     to.passiveEffects = from.passiveEffects;
 }