// Update is called once per frame void Update() { Vector3 point = new Vector3(_camera.pixelWidth / 2, _camera.pixelHeight / 2, 0); Ray ray = _camera.ScreenPointToRay(point); RaycastHit hit; Physics.Raycast(ray, out hit, rayDistance); if (hit.collider) { GameObject ob = hit.collider.gameObject; IInteractivable interactiveObject = ob.GetComponent <IInteractivable>(); if (interactiveObject is IInteractivable) { interactiveObject.showText(); if (interactiveObject is IActionable) { IActionable actionObject = interactiveObject as IActionable; MainIcon.GetComponent <UICursorIcon>().showAction(); if (Input.GetKeyDown(KeyCode.F)) { actionObject.doAction(); } } } } else { _controller.changeText(""); MainIcon.GetComponent <UICursorIcon>().showDefault(); } }
public DirectoryListItem(IActionable a) : base(a) { // Set up appearance verticalRightPanel = new StackPanel(); displayNameTextBlock = new TextBlock(); fullPathTextBlock = new TextBlock(); image = new Image(); this.Margin = this_Margin; this.Children.Add(image); this.Children.Add(verticalRightPanel); image.Source = new BitmapImage(getImageUri()); image.Margin = image_Margin; image.Height = 45; image.Width = 41; image.Stretch = Stretch.Fill; verticalRightPanel.Orientation = Orientation.Vertical; verticalRightPanel.Children.Add(displayNameTextBlock); verticalRightPanel.Children.Add(fullPathTextBlock); displayNameTextBlock.Text = a.Name; displayNameTextBlock.FontSize = 45; displayNameTextBlock.Margin = displayNameTextBox_Margin; displayNameTextBlock.FontFamily = displayNameTextBox_FontFamily; displayNameTextBlock.TextWrapping = TextWrapping.NoWrap; fullPathTextBlock.Text = a.Path.PathString; fullPathTextBlock.Foreground = (Brush)App.Current.Resources["PhoneSubtleBrush"]; fullPathTextBlock.Margin = fullPathTextBox_Margin; displayNameTextBlock.TextWrapping = TextWrapping.NoWrap; }
private void OnTriggerStay(Collider other) { if (other.tag == "Ground" || other.tag == "Player" || _grabing != null) { return; } // Debug.Log("Colidded with: " + other.ToString()); if (other.tag == "Pickable") { if (Input.GetKeyDown(KeyCode.E)) { Take(other.gameObject); } } if (other.tag == "Shelf") { if (Input.GetKeyDown(KeyCode.Q)) { IActionable actionable = other.GetComponent(typeof(IActionable)) as IActionable; actionable.Action(); } } }
public virtual void Action(IActionable target) { if (target != null) { target.AcceptAction(this.actionRequest); } }
private void ActionEndUpdate() { if (!target.IsIdle) { return; } this.targetIndex++; if (targets.Count <= this.targetIndex) { if (!target.IsReaction) { this.state.SetState(Phase.Idle); } else { this.state.SetState(Phase.ReactionStart); } } else { target = targets[this.targetIndex]; this.state.SetState(Phase.Action); } }
//------------------------------------------------------------------------- // State:Attack Idle private void IdleEnter() { this.actor = null; this.target = null; this.targetIndex = 0; this.targets.Clear(); }
public ListActionEventArgs(IActionable component, ConsoleKeyInfo?sourceKeys, T item, GraphicsContext g) { Component = component; KeySource = sourceKeys; Item = item; Graphics = g; }
/// <summary> /// アクションをする /// </summary> public override void Action(IActionable target) { if (target == null) { return; } target.AcceptAction(actionRequest); }
public void OnAction() { if (closestInteractableObject != null) { IActionable actionableComponent = closestInteractableObject.GetComponent <IActionable>(); actionableComponent.Action(); } }
private static List <InputAction> GetInputActions(this IActionable actionable) { if (actionable.UserConfig.InputGroups.TryGetValue(actionable.InputGroupName, out List <InputAction> inacs)) { return(inacs); } return(new List <InputAction>()); }
public override void OnActionExitWhenActor(IActionable target) { switch (this.behavior) { case BehaviorType.Throw: OnThrowActionExit(target); break; default: break; } }
public static ListingsListItem CreateListItem(IActionable a) { if (a is Document) return new DocumentListItem(a); else if (a is Directory) return new DirectoryListItem(a); else throw new Exception("Unexpected type"); }
public static Action GetAction(IActionable actionable, DbContext db, IAuthentication auth, string actionName, Framework.Core.Entities.User user) { var actionType = GetActionType(actionable.ActualType(), actionName); var action = (Action)Activator.CreateInstance(actionType, actionable); action.Setup(db, user, auth); return(action); }
private string InjectModuleActions(ModuleInfo ModuleInfo) { try { if (LoadControl(Page.ResolveUrl("~/" + ModuleInfo.ModuleControl.ControlSrc)) is IActionable) { IActionable ctl = LoadControl(Page.ResolveUrl("~/" + ModuleInfo.ModuleControl.ControlSrc)) as IActionable; if (ctl != null && ctl.ModuleActions != null) { foreach (ModuleAction rootAction in ctl.ModuleActions) { //Process Children List <ModuleAction> actions = new List <ModuleAction>(); foreach (ModuleAction action in rootAction.Actions) { if (action.Visible) { if ((Globals.IsAdminControl() == false) || (action.Secure != SecurityAccessLevel.Anonymous && action.Secure != SecurityAccessLevel.View)) { if (!action.Icon.Contains("://") && !action.Icon.StartsWith("/") && !action.Icon.StartsWith("~/")) { action.Icon = "~/images/" + action.Icon; } if (action.Icon.StartsWith("~/")) { action.Icon = Globals.ResolveUrl(action.Icon); } actions.Add(action); } } } //var oSerializer = new JavaScriptSerializer(); //if (rootAction.Title == Localization.GetString("ModuleGenericActions.Action", Localization.GlobalResourceFile)) //{ // AdminActionsJSON = oSerializer.Serialize(actions); //} //else //{ // if (rootAction.Title == Localization.GetString("ModuleSpecificActions.Action", Localization.GlobalResourceFile)) // { // CustomActionsJSON = oSerializer.Serialize(actions); // } //} } } } } catch { } return(string.Empty); }
private static List <InputAction> GetInputActions(this IActionable @for) { List <InputAction> inacs; if (@for.UserConfig.InputGroups.TryGetValue(@for.InputGroupName, out inacs)) { return(inacs); } return(new List <InputAction>()); }
public void LoadKinectDepthTrackingPlugin() { trackerKinectDepth = LoadTrackingPlugin("Tracking.KinectV1Depth"); actionableKinectGestures = trackerKinectDepth as IActionable; if (actionableKinectGestures != null) { actionableKinectGestures.ActionOccured += ActionableKinectGestures_ActionOccured; } }
//------------------------------------------------------------------------- // 攻撃関連 /// <summary> /// 攻撃する /// </summary> public void Attack(IActionable target) { var attacker = FindAttacker(); if (attacker != null) { //attacker.Attack(target); attacker.DoAttackMotion(); } }
public void LoadUbisenseTrackingPlugin() { trackerUbisense = LoadTrackingPlugin("Tracking.Ubisense"); actionableUbisense = trackerUbisense as IActionable; if (actionableUbisense != null) { actionableUbisense.ActionOccured += ActionableUbisense_ActionOccured; } }
//------------------------------------------------------------------------- // State:Attack Start private void ActionStartEnter() { actor.OnActionStartWhenActor(); target = targets.TryGet(targetIndex); if (target != null) { target.OnActionStartWhenTarget(); } }
protected IListingsListItem(IActionable a) { ActionableItem = a; this.Orientation = Orientation.Horizontal; this.RenderTransform = new CompositeTransform(); _contentPanel = new StackPanel(); _contentPanel.Orientation = Orientation.Horizontal; this.Children.Add(_contentPanel); }
private void UseAction() { IActionable actionable = itemInstance.GetComponent <IActionable>() as IActionable; if (actionable != null) { if (actionable.Action()) { anim.Play("shoot"); } } }
private static void ResolveAction(JObject jObject, [NotNull] IActionable hotkey) { var actionToken = jObject[nameof(Hotkey.Action)]; if (actionToken?.Type == JTokenType.String) { string actionString = actionToken.Value <string>(); if (Enum.TryParse(actionString, out ToastifyActionEnum _)) { hotkey.Action = JsonConvert.DeserializeObject <ToastifyAction>($"\"{actionString}\"", new ToastifyActionAsEnumJsonConverter()); } } }
private static void Validate(this IActionable @for, Func <List <InputAction>, InputAction, bool> match, string message, Func <HashSet <string>, Func <string>, string[]> args) { List <InputAction> inacs = @for.GetInputActions(); HashSet <string> removed = new HashSet <string>(); inacs.RemoveAll(i => match(inacs, i) && (removed.Add(i.ActionName) || true)); if (removed.Any()) { @for.Console.Warning(message, args(removed, () => string.Join(" ", removed.Select(s => "\"" + s + "\"").ToArray()))); } }
protected void Page_Load(object sender, EventArgs e) { Literal lit = new Literal(); IActionable actionable = ModuleControl as IActionable; if (actionable != null) { string JsonAction = ""; JsonAction = "["; foreach (ModuleAction action in actionable.ModuleActions) { if (ModulePermissionController.HasModuleAccess(action.Secure, "CONTENT", ModuleConfiguration)) { string url = string.Empty; if (!string.IsNullOrEmpty(action.Url) && action.Url.Length > 0) { var splitarray = action.Url.Split('#'); url = splitarray[0]; if (url.Contains("?")) { url += "&skinsrc=" + "[g]skins/vanjaro/base"; } else { url += "?skinsrc=" + "[g]skins/vanjaro/base"; } if (splitarray.Length > 1) { url += "#" + splitarray[1]; } } JsonAction += "{\"Title\":\"" + action.Title + "\", \"Icon\":\"" + action.Icon + "\",\"Url\":\"" + url + "\",\"NewWindow\":\"" + action.NewWindow + "\",\"ModuleId\":\"" + ModuleConfiguration.ModuleID + "\"},"; } } JsonAction = JsonAction.TrimEnd(','); JsonAction += "]"; if (JsonAction != "[]") { lit.Text = "<script type=\"text/javascript\" data-actionmid=\"" + ModuleConfiguration.ModuleID + "\">" + JsonAction + "</script>"; } } if (HasSettings(Page, ModuleConfiguration)) { lit.Text += "<script type=\"text/javascript\" data-settingsmid=\"" + ModuleConfiguration.ModuleID + "\"></script>"; } Page.Header.Controls.Add(lit); }
public DocumentListItem(IActionable a) : base(a) { // Set up appearance displayNameTextBlock = new TextBlock(); this.Children.Add(displayNameTextBlock); displayNameTextBlock.Text = a.DisplayName; displayNameTextBlock.Margin = displayNameTextBox_Margin; displayNameTextBlock.FontFamily = displayNameTextBox_FontFamily; displayNameTextBlock.TextWrapping = TextWrapping.Wrap; displayNameTextBlock.FontSize = (Double)App.Current.Resources["PhoneFontSizeExtraLarge"]; }
//------------------------------------------------------------------------- // State:ReactionStart private void ReactionStartEnter() { // actorとtargetを入れ替える var target = this.targets[0]; this.targets.Clear(); targets.Add(this.actor); this.actor = target; // Reactionモードにして、targetIndexも0に戻す this.targetIndex = 0; // 各種コールバックを呼ぶ actor.OnReactionStartWhenActor(); target.OnReactionStartWhenTarget(); }
public static void SetUp(this IActionable @this) { @this.Validate((all, i) => [email protected](i.ActionName), "Ignoring unknown input action{0} configured for {1}: {2}.", (r, rs) => new string[] { r.Skip(1).Any() ? "s" : "", @this.InputGroupName, rs() }); @this.Validate((all, i) => all.Any(i.Duplicate), "Ignoring duplicate {0} keybindings for: {1}.", (r, rs) => new string[] { @this.InputGroupName, rs() }); KeyEventHandler callback = null; callback = (sender, ev) => { try { if (@this.Holder == null) { hook.KeyDown -= callback; } else if (CameraVisibility.Focused && @this.Holder.isActiveAndEnabled) { Action action; foreach (string actionName in @this.GetInputActions().Where(i => i.Activated(ev)).Select(i => i.ActionName)) { if (@this.Actions.TryGetValue(actionName, out action)) { action(); } else { @this.Console.Warning("Ignoring unknown action name for {0}: \"{1}\".", @this.InputGroupName, actionName); } } } } catch (Exception e) { Debug.LogException(e, @this.Holder); } }; hook.KeyDown += callback; }
public Entity(Configuration.Dimmer dimmer, WifiLink.IBridge bridge, With.Messaging.Client.IEndpoint clientEndpoint) { _dimmer = dimmer; _bridge = bridge; _clientEndpoint = clientEndpoint; _on = new On(dimmer, bridge); _off = new Off(dimmer, bridge); _level = new Level(dimmer, bridge); _messages = new Subject <Message.IMessage>(); Identity = _dimmer.ToEntityIdentity(); Description = _dimmer.ToEntityDescription(); Observables = Enumerable.Empty <IObservable>(); Actionables = new IActionable[] { _off, _on, _level }; }
public static void SetUp(this IActionable actionable) { actionable.Validate((all, i) => !actionable.Actions.ContainsKey(i.ActionName), "Ignoring unknown input action{0} configured for {1}: {2}.", (r, rs) => new string[] { r.Skip(1).Any() ? "s" : "", actionable.InputGroupName, rs(), }); actionable.Validate((all, i) => all.Any(i.Duplicate), "Ignoring duplicate {0} keybindings for: {1}.", (r, rs) => new string[] { actionable.InputGroupName, rs() }); void callback(object sender, KeyEventArgs ev) { try { if (actionable.Holder == null) { GlobalHook.KeyDown -= callback; } else if (CameraVisibility.Focused && actionable.Holder.isActiveAndEnabled) { foreach (string actionName in actionable.GetInputActions().Where(i => i.Activated(ev)).Select(i => i.ActionName)) { if (actionable.Actions.TryGetValue(actionName, out Action action)) { action(); } else { actionable.Console.Warning("Ignoring unknown action name for {0}: \"{1}\".", actionable.InputGroupName, actionName); } } } } catch (Exception e) { Debug.LogException(e, actionable.Holder); } } GlobalHook.KeyDown += callback; }
/// <summary> /// Checks the target object to analyze if it is a interactive object. /// </summary> private void SearchInteractiveObjects() { if (!m_ItemCoolDown) { if (Target) { IActionable target = Target.GetComponent <IActionable>(); if (target != null) { if (InputManager.GetButtonDown(m_UseButton)) { StartCoroutine(Interact(target)); } } } } }
private void OnThrowActionExit(IActionable target) { // ターゲットがいなければ床に落ちる if (target == null) { ItemManager.Instance.AddItem(this); return; } // ターゲットがいれば当たったかどうかで判断 if (target.ActionResponse.IsHit) { Destory(); } else { ItemManager.Instance.AddItem(this); } }
public void MainShow(IActionable a) { act = a; try { a.MainFunction(); PrintWin(a); } catch (NullReferenceException nfe) { Console.WriteLine(nfe.Message); } catch (ArgumentOutOfRangeException ae) { Console.WriteLine(ae.Message); } catch (Exception e) { Console.WriteLine(e.Message); } }
static void Main(string[] args) { //var type = "dog"; //if (type == "dog") //{ // Console.WriteLine("bark"); //} else if (type == "cat") //{ // Console.Write("Meow"); //} else if (type == "bird") //{ // Console.Write("Cheep Cheep"); //} //refactor IActionable mysound = AnimalCreator.Create("dog"); Console.WriteLine(mysound.MakeSound()); Console.ReadKey(); }
void Update() { float moveX = Input.GetAxis("Horizontal"); PlayerOrientation(moveX); rb.MovePosition(rb.position + Vector2.right * moveX * speed * Time.deltaTime); if (Input.GetKeyDown(KeyCode.Space)) { rb.AddForce(Vector2.up * 8000); } if (Input.GetKeyDown(KeyCode.F) && currentActionable != null) { Debug.Log("current != null"); IActionable actionable = currentActionable.GetComponent <IActionable>(); if (actionable != null) { Debug.Log("actionable.Action()"); actionable.Action(); } } }
public ActionableException(IActionable data) { this.ActionableItem = data; }
public MyUri AddArg(IActionable value) { return this.AddArg("param", value.Path.PathString); }
private void TryMoveItem(IActionable a, Directory newParent) { var newLocation = Utils.CreateActionableFromPath(new PathStr(newParent.Path.NavigateIn(a.Name))); if (newLocation.Exists()) { var type = a.GetType().Name.ToLower(); MessageBoxResult r = MessageBox.Show(string.Format("There is already an {0} with the same name at the specified destination. Tap OK to overwrite the existing {0}, or Cancel to skip this item.", type), a.DisplayName, MessageBoxButton.OKCancel); if (r != MessageBoxResult.OK) return; newLocation.Delete(true); } try { a.Move(newParent); } catch (Exception ex) { return; } }
private void TryMoveItem(IActionable a, Directory newLoc) { try { a.Move(newLoc); } catch (ActionableException) { MessageBoxResult r = MessageBox.Show("There is already a document or directory with the same name at this " + "location. Tap OK to overwrite this item, or Cancel to skip it.", a.Name, MessageBoxButton.OKCancel); if (r == MessageBoxResult.OK) { (new Directory(newLoc.Path.NavigateIn(a.Name))).Delete(); TryMoveItem(a, newLoc); } } }
private void NavigateOnSuccess(IActionable act) { var prevPage = GetPreviousPageUri(); act.IsTemp = false; if (prevPage == null) { Utils.TryGoBack(NavigationService); } else if ((prevPage.StartsWith(App.AddNewItem.OriginalString) && _actionable is Document)) { act.Open(NavigationService); } else if (prevPage.StartsWith(App.DocumentEditor.OriginalString)) { NavigationService.RemoveBackEntry(); act.Open(NavigationService); } else { Utils.TryGoBack(NavigationService); } }
private bool IsInIgnoreList(Directory dest, IActionable itemToMove) { bool b = false; foreach (IActionable a in _actionables) b = b || a.Path.Equals(dest.Path); return b || dest.Path.PathString.Equals("Shared") || dest.Path.IsInTrash; }
public static void CheckForExists(IActionable param, string paramName) { CheckForNull(param, paramName); if (!param.Exists()) throw new ArgumentException("The parameter " + paramName + " did not exist."); }
private void IconButton_Okay_Click(object sender, EventArgs e) { // Ensure the filename is unique. string newName = NewNameBox.Text.Trim(); IList<string> badCharsInName = new List<string>(); if (!Utils.IsValidFileName(newName, out badCharsInName)) { AlertUserBadChars(badCharsInName); return; } if (!IsUniqueFileName(newName)) { AlertUserDuplicateName(); return; } if (newName.StartsWith(".")) { AlertUserDotFile(); return; } // Rename the item _actionable = _actionable.Rename(newName); _actionable.IsTemp = false; if (_actionable.IsTemp) _actionable.Open(NavigationService); else NavigationService.GoBack(); }
private void GetArgs() { IList<object> args = Utils.GetArguments(); _actionable = (IActionable)args[0]; }
private void GetArgs() { _actionable = Utils.CreateActionableFromPath(new PathStr(NavigationContext.QueryString["param"])); if (NavigationContext.QueryString.ContainsKey("istemp")) _actionable.IsTemp = bool.Parse(NavigationContext.QueryString["istemp"]); }
private bool NewCOM() { try { sysClient = new EncoreClient(); } catch(Exception ex) { Logger.Log("Could not connect to COM: " + ex.Message); return false; } return true; }
private bool NewWcf() { try { sysClient = new WCFClient(fileSettings.WcfConnString); } catch (Exception ex) { Logger.Log("Could not connect to WCF: " + ex.Message); return false; } return true; }
/// <summary> /// Removes the favorite at the Path and adds a favorite at the newPath /// </summary> /// <param name="Path2"></param> /// <param name="newPath"></param> public static void ReplaceFavorite(IActionable oldFave, IActionable newFave) { oldFave.IsFavorite = false; newFave.IsFavorite = true; }
//public bool HasVariableOpacity; //public static readonly DependencyProperty ListingOpacityProperty = DependencyProperty.Register("ListingOpacity", typeof(double), typeof(ListingsListItem), null); //public double ListingOpacity //{ // get // { // return (double)GetValue(ListingOpacityProperty); // } // set // { // if (HasVariableOpacity) // SetValue(ListingOpacityProperty, value); // } //} protected ListingsListItem(IActionable a) { // Initialize fields ActionableItem = a; this.Orientation = Orientation.Horizontal; }