public InvokeResult BehaviorBindMenu(string behaviorCode, IList <string> menuIds) { InvokeResult result = new InvokeResult { Success = true }; try { List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>(); MenuBehavior mb = new MenuBehavior(); mb.BehaviorCode = behaviorCode; statements.Add(new IBatisNetBatchStatement { StatementName = mb.GetDeleteMethodName(), ParameterObject = mb.ToStringObjectDictionary(false), Type = SqlExecuteType.DELETE }); foreach (var menuId in menuIds) { mb.MenuId = menuId; statements.Add(new IBatisNetBatchStatement { StatementName = mb.GetCreateMethodName(), ParameterObject = mb.ToStringObjectDictionary(false), Type = SqlExecuteType.INSERT }); } BuilderFactory.DefaultBulder(GlobalManager.getConnectString()).ExecuteNativeSqlNoneQuery(statements); } catch (Exception ex) { result.Success = false; result.ErrorMessage = ex.Message; } return(result); }
void Start() { _menuRoots = GameObject.FindGameObjectsWithTag("MenuRoot"); _menus = GameObject.FindGameObjectsWithTag("Menu"); _currentState = MoverState.PASSIVE; //Account for differing aspect ratios Vector2 screenSize = new Vector2(Screen.width, Screen.height); Vector2 screenDiff = _layoutOriginalAspectRatio - screenSize; if (Mathf.Abs(screenDiff.x) < Mathf.Abs(screenDiff.y)) { float amt = _layoutOriginalAspectRatio.x / screenSize.x; screenSize *= amt; } else { float amt = _layoutOriginalAspectRatio.y / screenSize.y; screenSize *= amt; } float horizRatio = screenSize.x / (float)_layoutOriginalAspectRatio.x; float vertRatio = screenSize.y / (float)_layoutOriginalAspectRatio.y; _guiMatrix = Matrix4x4.TRS(new Vector3(0, 0, 0), Quaternion.identity, new Vector3(horizRatio, vertRatio, 1)); foreach (GameObject menu in _menus) { MenuBehavior menuScript = menu.GetComponent(typeof(MenuBehavior)) as MenuBehavior; menuScript.baseLocation = _guiMatrix.MultiplyPoint(menuScript.baseLocation); } }
public InvokeResult UpdateMenuBehavior(IList <string> behaviorCodes) { InvokeResult result = new InvokeResult { Success = true }; try { List <string> statements = new List <string>(); MenuBehavior mb = new MenuBehavior(); statements.Add("delete from " + mb.GetMappingTableName()); foreach (var behaviorCode in behaviorCodes) { string sql = string.Format("insert into {0} select MenuId,'{1}' from sys_menu where status = 1 and endFlag = 1 ", mb.GetMappingTableName(), behaviorCode); statements.Add(sql); } BuilderFactory.DefaultBulder(GlobalManager.getConnectString()).ExecuteNativeSqlNoneQuery(statements); } catch (Exception ex) { result.Success = false; result.ErrorMessage = ex.Message; } return(result); }
private void Update() { if (Input.GetKeyUp("escape")) { previousScreen.SetActive(true); gameObject.SetActive(false); } if ((Input.GetKeyUp("space") || Input.GetKeyUp("return"))) { if (keyboardLoadsLevel) { if (levelToLoad == "") { Debug.LogWarning("There is no inputted level to load!: " + gameObject.name); return; } MenuBehavior.LoadLevelKeyboard(levelToLoad); } else if (returnGoesBack) { previousScreen.SetActive(true); gameObject.SetActive(false); } } }
public void ShowMenu(MenuBehavior menu) { if (CurrentMenu != null) { CurrentMenu.IsOpen = false; } CurrentMenu = menu; CurrentMenu.IsOpen = true; }
// Update is called once per frame void Update() { if (popup == null) { if (Input.GetAxis("LeftAnalogZ") > 0f && Time.realtimeSinceStartup - lastChange > changeInterval) { lastChange = Time.realtimeSinceStartup; index += 1; } if (Input.GetAxis("LeftAnalogZ") < 0f && Time.realtimeSinceStartup - lastChange > changeInterval) { lastChange = Time.realtimeSinceStartup; index--; } if (index < 0) { index = choiceSize - 1; } if (index >= choiceSize) { index = 0; } //index=index%choiceSize; cursor.transform.position = new Vector3(cursor.transform.position.x, minY + index * height, 0); if (Input.GetButton("A") && Time.realtimeSinceStartup - lastChange > changeInterval) { lastChange = Time.realtimeSinceStartup; Debug.Log("A Button"); if (index == 2) { //shouldCopy=false; popup = new GameObject(); popup.AddComponent("MenuBehavior"); popup.transform.position = transform.position + new Vector3(width * 1.5f, height * 1.5f, 0); MenuBehavior MB = (MenuBehavior)popup.GetComponent("MenuBehavior"); MB.makeChange(lastChange); index = 1; } if (index == 1) { Debug.Log("AHOY!"); gameObject.AddComponent("GUIText"); GUIText txt = (GUIText)this.gameObject.GetComponent("GUIText"); txt.text = "Ahoy!"; } if (index == 0) { Destroy(cursor.gameObject); Destroy(this.gameObject); } } } }
protected override void ResolveDependencies() { this.menuBehavior = new MenuBehavior(new List <Vector2> { new Vector2(350, 530), new Vector2(350, 580) }); this.Scene.EntityManager.Add(new Entity() .AddComponent(new Transform2D { DrawOrder = -1 }) .AddComponent(new Sprite(WaveContent.Assets.Sprites.MenuOver_png)) .AddComponent(new SpriteRenderer()) .AddComponent(this.menuBehavior)); }
/** * Static constructor. */ public static void InitGeneralUtils() { BallUtils.InitBallUtilities(); NetUtils.InitNetUtils(); m_mainScript = GameObject.Find("ScriptHub").GetComponent <Main>(); m_agentScript = GameObject.Find("Agent").GetComponent <AgentInput>(); m_humanScript = GameObject.Find("P1").GetComponent <HumanInput>(); m_sessionScript = GameObject.Find("ScriptHub").GetComponent <SessionBehavior>(); m_menuScript = GameObject.Find("ScriptHub").GetComponent <MenuBehavior>(); m_ballScript = GameObject.Find("Ball").GetComponent <BallBehavior>(); m_dataScript = GameObject.Find("ScriptHub").GetComponent <DataManger>(); ROLE_SERVER = 0; ROLE_CLIENT = 1; HUMAN_ID = 0; HUMAN_LEFT = 2; HUMAN_RIGHT = 3; AGENT_ID = 1; AGENT_SKILL_RANDOM = 0; AGENT_SKILL_NORMAL = 1; AGENT_SKILL_FAST = 2; RALLY_ID = 2; UNASSIGNED = 10; INPUT_KEYBOARD = 0; INPUT_MOUSE = 1; INPUT_HYDRA = 2; BALL_RADIUS_LARGE = 2; BALL_RADIUS_MEDIUM = 1; BALL_RADIUS_SMALL = 0.5F; PADDLE_SIZE_LARGE = 9.0757605F; //150% PADDLE_SIZE_MEDIUM = 6.050507F; //100% PADDLE_SIZE_SMALL = 4.53788025F; //75% PADDLE_WIDTH_MEDIUM = 7.41716F; RASyN_IP = "127.0.0.1"; RASyN_PORT_MAP = new Dictionary <string, int> (); PONG_SERVER_ID = "PongServer"; PONG_CLIENT1_ID = "PongClient1"; PONG_CLIENT2_ID = "PongClient2"; ASSIGNED_PONG_CLIENT_ID = "NULL"; RASyN_PORT_MAP.Add(PONG_SERVER_ID, 19000); RASyN_PORT_MAP.Add(PONG_CLIENT1_ID, 19011); RASyN_PORT_MAP.Add(PONG_CLIENT2_ID, 19012); jss = new JsonSerializerSettings(); jss.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; jss.MissingMemberHandling = MissingMemberHandling.Ignore; //jss.PreserveReferencesHandling = PreserveReferencesHandling.Objects; DRAW_TIMEOUT = 1000 * 60; //60 second timeout in milliseconds BallUtils.InitBallUtilities(); NetUtils.InitNetUtils(); rallyCfg = new RallyConfiguration(Application.dataPath + "/Config/RallyConfiguration.json"); }
public void recieveMenuEvent (MenuBehavior.ButtonAction action) { switch (action) { case MenuBehavior.ButtonAction.ABOUT: break; case MenuBehavior.ButtonAction.EXIT: _menu.Hint ("Good Bye!"); //Application.Quit (); break; case MenuBehavior.ButtonAction.START: break; case MenuBehavior.ButtonAction.PLAYGROUND: break; default: break; } }
static void Main(string[] args) { #region Event AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; Application.ThreadException += Application_ThreadException; #endregion Event #region Browser注册 CefSettingClass.InitializeCefSetting(); #endregion Browser注册 Logs.Fatal("Browser注册"); #region Dev皮肤注册 BonusSkins.Register(); SkinManager.EnableFormSkins(); SkinManager.EnableMdiFormSkins(); //多文档皮肤支持 UserLookAndFeel.Default.SetSkinStyle("Office 2013 Dark Gray"); //设置默认皮肤样式 #endregion Dev皮肤注册 #region Default Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); #endregion Default #region Login FmLogin fm = new FmLogin(); if (fm.ShowDialog() == DialogResult.OK) { MenuBehavior.InitializeSystemMenu(); MenuBehavior.InitializeLocalMenu(); //Application.Run(new FmMain()); Application.Run(new FmMaintain()); } else { MenuBehavior.InitializeSystemMenu(); MenuBehavior.InitializeLocalMenu(); //Application.Run(new FmMain()); Application.Run(new FmMaintain()); } #endregion Login }
/** * Static constructor. */ public static void InitNetUtils() { m_mainScript = GameObject.Find("ScriptHub").GetComponent <Main>(); m_menuScript = GameObject.Find("ScriptHub").GetComponent <MenuBehavior>(); }
void Update() { bool menuIsActive = false; bool menuIsClosing = false; foreach (GameObject menu in _menus) { MenuBehavior menuBehavior = menu.GetComponent(typeof(MenuBehavior)) as MenuBehavior; if (menuBehavior.currentState == MenuBehavior.MenuState.ACTIVE || menuBehavior.currentState == MenuBehavior.MenuState.ACTIVATING) { menuIsActive = true; _activeMenu = menu; } else if (menuBehavior.currentState == MenuBehavior.MenuState.DEACTIVATION || menuBehavior.currentState == MenuBehavior.MenuState.SELECTION) { menuIsClosing = true; } } switch (_currentState) { case MoverState.FADING_IN: _fadePushPercent = Mathf.Clamp((Time.time - _fadeStartTime) / (_fadeInTime * _fadeStartPercent), 0.0f, 1.0f); foreach (GameObject menuRoot in _menuRoots) { GameObject menu = null; MenuBehavior menuRootBehavior = null; foreach (Transform child in menuRoot.transform) { if (child.name == "Menu") { menu = child.gameObject; menuRootBehavior = menu.GetComponent(typeof(MenuBehavior)) as MenuBehavior; } } if (menu != _activeMenu) { Vector3 awayVector = new Vector3(menuRoot.transform.position.x - _activeMenu.transform.position.x, menuRoot.transform.position.y - _activeMenu.transform.position.y, 0).normalized *_fadeCurve.Evaluate(1 - _fadePushPercent) * _fadeThrowDistance; if (menuRootBehavior != null) { menuRoot.transform.position = menuRootBehavior.baseLocation + awayVector; menuRootBehavior.setOpacity(_fadePushPercent); } } } if (Time.time > _fadeStartTime + (_fadeInTime * _fadeStartPercent)) { _currentState = MoverState.PASSIVE; foreach (GameObject menu in _menus) { if (menu != _activeMenu) { MenuBehavior menuBehavior = menu.GetComponent(typeof(MenuBehavior)) as MenuBehavior; menuBehavior.currentState = MenuBehavior.MenuState.INACTIVE; } } return; } break; case MoverState.FADING_OUT: _fadePushPercent = Mathf.Clamp((Time.time - _fadeStartTime) / _fadeOutTime, 0.0f, 1.0f); if (!menuIsActive) { _fadeStartTime = Time.time; _fadeStartPercent = _fadePushPercent; _currentState = MoverState.FADING_IN; return; } foreach (GameObject menuRoot in _menuRoots) { GameObject menu = null; MenuBehavior menuRootBehavior = null; foreach (Transform child in menuRoot.transform) { if (child.name == "Menu") { menu = child.gameObject; menuRootBehavior = menu.GetComponent(typeof(MenuBehavior)) as MenuBehavior; } } if (menu != _activeMenu) { Vector3 awayVector = new Vector3(menuRoot.transform.position.x - _activeMenu.transform.position.x, menuRoot.transform.position.y - _activeMenu.transform.position.y, 0).normalized *_fadeCurve.Evaluate(_fadePushPercent) * _fadeThrowDistance; if (menuRootBehavior != null) { menuRoot.transform.position = menuRootBehavior.baseLocation + awayVector; menuRootBehavior.setOpacity(1.0f - _fadePushPercent); } } } break; case MoverState.PASSIVE: if (menuIsActive && !menuIsClosing) { _fadeStartTime = Time.time; _currentState = MoverState.FADING_OUT; foreach (GameObject menu in _menus) { if (menu != _activeMenu) { MenuBehavior menuBehavior = menu.GetComponent(typeof(MenuBehavior)) as MenuBehavior; menuBehavior.currentState = MenuBehavior.MenuState.DISABLED; } } return; } if (_handSweepEnabled) { _throwLocation = Mathf.Clamp(_throwLocation + (ScaleManager._scaleRate * _throwSpeed * Time.deltaTime), 0, 1.0f); foreach (GameObject menuRoot in _menuRoots) { MenuBehavior menuRootBehavior = null; foreach (Transform child in menuRoot.transform) { if (child.name == "Menu") { menuRootBehavior = child.gameObject.GetComponent(typeof(MenuBehavior)) as MenuBehavior; } } Vector3 awayVector = new Vector3(menuRoot.transform.position.x - gameObject.transform.position.x, menuRoot.transform.position.y - gameObject.transform.position.y, 0).normalized *_throwFilter.Evaluate(_throwLocation) * _fullThrowDistance; if (menuRootBehavior != null) { menuRoot.transform.position = menuRootBehavior.baseLocation + awayVector; } } } break; } }
public void recieveMenuEvent(MenuBehavior.ButtonAction action) { ++i; eventText.text = "Events:\n" + i + ": " + action.ToString() + eventText.text.Substring(7); }