コード例 #1
0
    void Awake()
    {
        GameObject door = GameObject.FindGameObjectWithTag("Door");

        door.transform.position = new Vector3(-.23f, -7.99f, 0f);

        // get access to Time System and Player Action script
        tSystem  = door.GetComponent <TimeSystem>();
        dOptions = door.GetComponent <ActionsMenu>();
    }
コード例 #2
0
 public static void SetMenuVisibility(ActionsMenu menu, string menuItemId, bool visible)
 {
     try
     {
         menu.GetMenuItem(menuItemId).Visible = visible;
     }
     catch (Exception exception)
     {
         Trace.WriteLine(exception);
     }
 }
コード例 #3
0
ファイル: Tutorial.cs プロジェクト: dhengkt/CapstoneProject
    void Awake()
    {
        GameObject door = GameObject.FindGameObjectWithTag("Door");

        door.transform.position = new Vector3(-.23f, -7.99f, 0f);
        tSystem     = door.GetComponent <TimeSystem>();
        dOptions    = door.GetComponent <ActionsMenu>();
        tuFlowchart = FindObjectOfType <Flowchart>();
        tuFlowchart.SetBooleanVariable("isDone", false);
        player = GameObject.FindObjectOfType <Player>();
    }
コード例 #4
0
 void Awake()
 {
     //Check if instance already exists
     if (ins == null)
     {
         //if not, set instance to this
         ins = this;
     }
     //If instance already exists and it's not this:
     else if (ins != this)
     {
         //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
         Destroy(gameObject);
     }
 }
コード例 #5
0
        public void ProcessControls_OnValidCall_UpdateControls()
        {
            // Arrange
            var menuItemTemplateAdded = false;

            SetupShimsForHttpRequest();
            var control   = new Control();
            var lblFilter = new Label {
                ID = "lblFilter"
            };
            var lblFilterText = new Label {
                ID = "lblFilterText"
            };
            var newMenu = new NewMenu();

            ShimTemplateBasedControl.AllInstances.ControlsGet = _ => new ControlCollection(new Control());
            var actionsMenu = new ActionsMenu();

            control.Controls.Add(lblFilter);
            control.Controls.Add(lblFilterText);
            control.Controls.Add(newMenu);
            control.Controls.Add(actionsMenu);
            PrivateObject.SetField("allowEditToggle", true);
            ShimToolBarMenuButton.AllInstances.AddMenuItemStringStringStringStringStringString =
                (_, _2, _3, _4, _5, _6, _7) =>
            {
                menuItemTemplateAdded = true;
                return(new MenuItemTemplate());
            };
            ShimToolBarMenuButton.AllInstances.AddMenuItemSeparator = _ => { };
            ShimToolBarMenuButton.AllInstances.GetMenuItemString    = (_, __) => new MenuItemTemplate();
            ShimControl.AllInstances.FindControlString = (_, __) => lblFilterText;

            // Act
            PrivateObject.Invoke("processControls", control, DummyString, DummyString, new ShimSPWeb().Instance);

            // Assert
            this.ShouldSatisfyAllConditions(
                () => lblFilter.Text.ShouldContain(DummyString),
                () => menuItemTemplateAdded.ShouldBeTrue());
        }
コード例 #6
0
        private void processControls(Control parentControl, string listname, string listid, string viewid, string defaultcontrol, string webpartid, string ZoneIndex, bool hideNew)
        {
            foreach (Control childControl in parentControl.Controls)
            {
                if (childControl.ToString() == "System.Web.UI.WebControls.Label")
                {
                    if (childControl.ID == "lblFilter")
                    {
                        //System.Web.UI.WebControls.HyperLink hl = (System.Web.UI.WebControls.HyperLink)childControl;
                        //hl.NavigateUrl = "Javascript:switchFilter" + ZoneIndex + "('" + hl.ClientID + "');";

                        try
                        {
                            System.Web.UI.WebControls.Label lblFilterText = (System.Web.UI.WebControls.Label)parentControl.FindControl("lblFilterText");
                            System.Web.UI.WebControls.Label lblLink       = (System.Web.UI.WebControls.Label)childControl;
                            lblLink.Text = "<a onclick=\"Javascript:switchFilter" + ZoneIndex + "('" + lblFilterText.ClientID + "');\">";

                            filterIndex = parentControl.Parent.Controls.IndexOf(parentControl);
                        }
                        catch { }
                    }
                }

                if (childControl.ToString().ToUpper() == "MICROSOFT.SHAREPOINT.WEBCONTROLS.NEWMENU")
                {
                    if (hideNew)
                    {
                        childControl.Visible = false;
                    }
                    else if (useNewMenu)
                    {
                        if (hasList)
                        {
                            NewMenu menu = (NewMenu)childControl;
                            try
                            {
                                Microsoft.SharePoint.WebControls.MenuItemTemplate mnu = menu.GetMenuItem("New0");
                                mnu.ClientOnClickNavigateUrl = "javascript:newAppPopup('" + list.ID.ToString().ToUpper() + @"');";
                                string txt      = mnu.Text;
                                int    spaceloc = txt.IndexOf(" ");
                                txt = txt.Substring(0, spaceloc);
                                if (newMenuName == "")
                                {
                                    mnu.Text = txt + " " + listname;
                                }
                                else
                                {
                                    mnu.Text = txt + " " + newMenuName;
                                }
                                menu.MenuControl.ClientOnClickScript = "javascript:newAppPopup('" + list.ID.ToString().ToUpper() + @"');";
                            }
                            catch { }
                        }
                        else
                        {
                            NewMenu menu = (NewMenu)childControl;
                            try
                            {
                                Microsoft.SharePoint.WebControls.MenuItemTemplate mnu = menu.GetMenuItem("New0");
                                mnu.ClientOnClickNavigateUrl = SPContext.Current.Web.Url + "/_layouts/epmlive/newapp.aspx?List=" + listid;
                                string txt      = mnu.Text;
                                int    spaceloc = txt.IndexOf(" ");
                                txt = txt.Substring(0, spaceloc);
                                if (newMenuName == "")
                                {
                                    mnu.Text = txt + " " + listname;
                                }
                                else
                                {
                                    mnu.Text = txt + " " + newMenuName;
                                }
                                menu.MenuControl.ClientOnClickScript = "location.href='" + mnu.ClientOnClickNavigateUrl + "'";
                            }
                            catch { }
                        }
                    }
                    else if (listname != "Project Center" && listname != "Project Center Rollup" && rollupLists != "" && !disableNewButtonModification)
                    {
                        NewMenu menu = (NewMenu)childControl;
                        try
                        {
                            menu.GetMenuItem("New0").Visible     = false;
                            menu.MenuControl.NavigateUrl         = "";
                            menu.MenuControl.ClientOnClickScript = "";
                            string[] arrrolluplists = rollupLists.Split(',');
                            foreach (string rolluplist in arrrolluplists)
                            {
                                string[] arrrolluplist = rolluplist.Split('|');
                                string   image         = "";
                                try
                                {
                                    image = "/_layouts/images/" + arrrolluplist[1];
                                }
                                catch { }
                                menu.AddMenuItem("New1", "New " + arrrolluplist[0].Trim() + " Item", "", "", SPContext.Current.Web.Url + "/_layouts/epmlive/newitem.aspx?List=" + arrrolluplist[0] + "&Source=" + HttpUtility.UrlEncode(HttpContext.Current.Request.Url.ToString()), "");
                            }
                        }
                        catch { }
                    }
                    else
                    {
                        NewMenu          menu     = (NewMenu)childControl;
                        MenuItemTemplate template = menu.GetMenuItem("New0");
                    }
                }

                if (childControl.ToString().ToUpper() == "MICROSOFT.SHAREPOINT.WEBCONTROLS.ACTIONSMENU")
                {
                    ActionsMenu menu = (ActionsMenu)childControl;
                    if (rollupLists != "")
                    {
                        try { menu.GetMenuItem("EditInGridButton").Visible = false; }
                        catch { }
                        try { menu.GetMenuItem("ExportToDatabase").Visible = false; }
                        catch { }
                        if (rollupLists != "")
                        {
                            try
                            {
                                menu.GetMenuItem("ViewRSS").Visible = false;
                            }
                            catch { }
                            try
                            {
                                menu.GetMenuItem("SubscribeButton").Visible = false;
                            }
                            catch { }
                        }
                        try
                        {
                            SPWeb            web = SPContext.Current.Web;
                            MenuItemTemplate mnu = menu.GetMenuItem("ExportToSpreadsheet");
                            mnu.ClientOnClickScript = "location.href='" + web.ServerRelativeUrl + "/_layouts/epmlive/rollupexport.aspx?List=" + listid + "&View=" + viewid + "&Lists=" + HttpUtility.UrlEncode(rollupLists.Replace(",", ";")) + "'";
                        }
                        catch { }
                    }

                    string url = HttpContext.Current.Request.Url.AbsolutePath;
                    if (url.Contains("?"))
                    {
                        url += "&";
                    }
                    else
                    {
                        url += "?";
                    }

                    if (defaultcontrol.ToLower() == "grid")
                    {
                    }
                    else if (defaultcontrol.ToLower() == "gantt")
                    {
                        menu.AddMenuItem("ViewInGrid", "View In Grid", "/_layouts/epmlive/images/menugridview.GIF", "View list using EPM Live Grid.", url + "webpartid=" + webpartid + "&gridmode=grid", "");
                    }
                }

                if (childControl == null)
                {
                    return;
                }

                processControls(childControl, listname, listid, viewid, defaultcontrol, webpartid, ZoneIndex, hideNew);
            }
        }
コード例 #7
0
	public void init() {
		actions_menu = this;
		panel = gameObject;
	}