コード例 #1
0
        public ResponseModel AddScreenAction(ScreenAction screenAction)
        {
            ResponseModel result = new ResponseModel();

            string action = ((ModelType)screenAction.ActionType).ToString();
            int    value;

            if (int.TryParse(action, out value))
            {
                result.ResponseStatus = false;
                result.ResponseText   = "Sorry, Action Type has some error.";
                return(result);
            }

            if (!Context.Set <ScreenAction>().Any(x => x.FK_screenId == screenAction.FK_screenId && x.IsDeleted == false && x.ActionType == screenAction.ActionType))
            {
                screenAction.CreatedBy   = 0;
                screenAction.CreatedDate = DateTime.UtcNow;
                screenAction.IsDeleted   = false;
                Context.Set <ScreenAction>().Add(screenAction);

                SaveChanges();
                result.ResponseStatus = true;
                result.ResponseText   = "ScreenAction created successfully.";
            }
            else
            {
                result.ResponseStatus = false;
                result.ResponseText   = "Sorry Duplicate Records exists.";
            }
            return(result);
        }
コード例 #2
0
 public virtual void ForEachScreen(ScreenAction screenAction)
 {
     foreach (AppScreen appScreen in screenCache.Values)
     {
         screenAction.Invoke(appScreen);
     }
 }
コード例 #3
0
ファイル: PlayerHealth.cs プロジェクト: tediris/CS194GameDev
	// Use this for initialization
	void Start () {
		deathListeners = new List<DeathListener> ();
		screenAction = GameObject.Find ("Screen").GetComponent<ScreenAction> ();
		playerSprite = GetComponent<SpriteRenderer> ();
		playerControl = GetComponent<PlayerControl> ();
//		playerAnimator = GetComponent<Animator> ();
		foreach (Transform child in this.gameObject.transform) {
			if (child.name == "Ghost") {
				ghosty = child.gameObject;
			}
		}
		if (isLocalPlayer) {
			hearts = new Image[maxHealth];
//			panel = GameObject.Find ("Canvas").transform.FindChild ("Player 0");
			for (int i = 0; i < maxHealth; i++) {
				hearts [i] = GameObject.Find ("Heart" + (i + 1)).GetComponent<Image> ();
			}
//			playerAnimator = GetComponent<Animator> ();
//			playerSprite = GetComponent<SpriteRenderer> ();
//			foreach (Transform child in this.gameObject.transform) {
//				if (child.name == "Ghost") {
//					ghosty = child.gameObject;
//				}
//			}
		} else {
			// Need to actually use the
//			panel = GameObject.Find ("Canvas").transform.FindChild ("Player 0");
			return;
		}
//		healthBarBackground = panel.FindChild ("Health Background").GetComponent<RectTransform> ();
//		healthBar = healthBarBackground.FindChild ("Health Foreground").GetComponent<RectTransform> ();
		notificationText = GameObject.Find("Notice").GetComponent<NotificationText> ();
	}
コード例 #4
0
        public bool DeleteScreenAction(int id)
        {
            ScreenAction screenaction = Context.Set <ScreenAction>().FirstOrDefault(x => x.ActionId == id && !x.IsDeleted);

            screenaction.IsDeleted   = true;
            screenaction.DeletedBy   = 1;
            screenaction.DeletedDate = DateTime.UtcNow;
            SaveChanges();
            return(true);
        }
コード例 #5
0
        public void EditScreenAction(ScreenAction screenAction)
        {
            var screenactionObject = Context.Set <ScreenAction>().FirstOrDefault(x => x.ActionId == screenAction.ActionId);

            screenactionObject.ActionName   = screenAction.ActionName;
            screenactionObject.ActionType   = screenAction.ActionType;
            screenactionObject.ModifiedBy   = screenAction.ModifiedBy;
            screenactionObject.ModifiedDate = DateTime.UtcNow;
            screenactionObject.CreatedDate  = screenAction.CreatedDate;
            SaveChanges();
        }
コード例 #6
0
 public void CreateAction(ConsoleKey key, IPresenter presenter)
 {
     if (!m_keyAction.ContainsKey(key))
     {
         m_keyAction.Add(key, null);
     }
     m_keyAction[key] = new ScreenAction()
     {
         Presenter = presenter
     };
 }
コード例 #7
0
 public void CreateAction(ConsoleKey key, IPresenter presenter, string description)
 {
     if (!m_keyAction.ContainsKey(key))
     {
         m_keyAction.Add(key, null);
     }
     m_keyAction[key] = new ScreenAction()
     {
         Presenter = presenter, Description = description
     };
 }
コード例 #8
0
    private ScreenAction GetScreenAction(Type screenType)
    {
        ScreenAction screenAction;

        _screenActions.TryGetValue(screenType, out screenAction);

        if (screenAction == null)
        {
            screenAction = new ScreenAction();
            _screenActions[screenType] = screenAction;
        }

        return(screenAction);
    }
コード例 #9
0
ファイル: ShortcutTester.cs プロジェクト: larsw/storyteller
        public void shortcut_creates_a_button()
        {
            var command = MockRepository.GenerateMock <ICommand>();

            var shortcut = new ScreenAction
            {
                Name    = "some text",
                Binding = new InputBinding(command, new KeyGesture(Key.F8)),
                Icon    = Icon.Run
            };

            shortcut.BuildButton(_commands);

            _commands.AssertWasCalled(x => x.AddCommand("some text", command, Icon.Run));
        }
コード例 #10
0
        public void Menu(string text, Icon icon)
        {
            if (_item.ContextMenu == null)
            {
                _item.ContextMenu = new ContextMenu();
            }

            var action = new ScreenAction()
            {
                Binding = new InputBinding(_command, _gesture),
                Icon    = icon,
                Name    = text
            };

            _item.ContextMenu.Items.Add(CommandMenuItem.Build(action));
        }
コード例 #11
0
ファイル: CommandMenuItem.cs プロジェクト: larsw/storyteller
        public static MenuItem Build(ScreenAction screenAction)
        {
            var item = new MenuItem()
            {
                //Header = new DockPanel().Left<Label>(x => x.Content = screenAction.Name),
                Header           = screenAction.Name,
                InputGestureText = screenAction.KeyString,
                Tag     = screenAction,
                Command = screenAction.Command
            };


            item.Icon = new Image().Configure(x => x.SetIcon(screenAction.Icon));

            return(item);
        }
コード例 #12
0
        public void Add(Icon icon, string text, Action action, KeyGesture gesture)
        {
            var screenAction = new ScreenAction()
            {
                Binding = new InputBinding(new ActionCommand(action), gesture),
                Icon    = icon,
                Name    = text
            };

            InputBindings.Add(screenAction.Binding);
            var item = CommandMenuItem.Build(screenAction);

            item.StaysOpenOnClick = true;

            Items.Add(item);
        }
コード例 #13
0
ファイル: Game.cs プロジェクト: Craftist/RpgGame
        private static void GoTo_AddDialogueHistory(DialogueScreen screen, ScreenAction action)
        {
            (string line, bool isPlayerLine, bool isTechnical)historyEntry = ("", true, false);
            var dialogue = action.Dialogue?.Invoke();

            if (string.IsNullOrWhiteSpace(dialogue))
            {
                historyEntry.line = $"\"{dialogue}\"";
            }
            else
            {
                historyEntry.line = action.Description?.Invoke() ?? "";
            }

            screen.DialogueHistory.Add(historyEntry);
        }
コード例 #14
0
        public override void WriteJson(JsonWriter writer, object?value, JsonSerializer serializer)
        {
            JObject      jObject = new JObject();
            ScreenAction action  = value as ScreenAction;

            if (action == null)
            {
                throw new Exception($"{nameof(value)} should be {nameof(ScreenAction)}");
            }

            jObject.Add("Description", new JValue(action.Description?.Invoke() ?? ""));
            jObject.Add("Dialogue", new JValue(action.Dialogue?.Invoke() ?? ""));
            jObject.Add("SilverPrice", new JValue(action.SilverPrice?.Invoke() ?? 0));
            jObject.Add("GoldPrice", new JValue(action.GoldPrice?.Invoke() ?? 0));
            jObject.Add("DiamondsPrice", new JValue(action.DiamondsPrice?.Invoke() ?? 0));
            jObject.Add("EnergyPrice", new JValue(action.EnergyPrice?.Invoke() ?? 0));

            jObject.WriteTo(writer);
        }
コード例 #15
0
        // [HandleException]
        public ActionResult EditScreenAction(ScreenAction screenaction)
        {
            try
            {
                string action = ((ModelType)screenaction.ActionType).ToString();
                int    value;
                if (int.TryParse(action, out value))
                {
                    return(RedirectToAction("Index"));
                }

                _screenAPIController.EditScreenAction(screenaction);
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
コード例 #16
0
        private void CreateMenuScreen()
        {
            bool f2key = false;
            bool f3key = false;
            bool f5key = false;

            string menu = "Menu:  ";

            foreach (KeyValuePair <ConsoleKey, ScreenAction> item in m_keyAction)
            {
                if (item.Key > ConsoleKey.F2 && !f2key && EnableSave)
                {
                    f2key = true;
                    menu += "F2:Salvar e Sair  |  ";
                }
                else if (item.Key > ConsoleKey.F3 && !f3key && EnableSearch)
                {
                    f3key = true;
                    menu += "F3:Pesquisar  |  ";
                }
                else if (item.Key > ConsoleKey.F5 && !f5key && EnableSelectItem)
                {
                    f5key = true;
                    menu += "F5:Digite a posição e pressione F5 para selecionar  |  ";
                }

                ScreenAction act   = item.Value;
                string       value = act.Description;
                if (string.IsNullOrEmpty(value) && act.Presenter != null)
                {
                    value = act.Presenter.Name;
                }

                menu += string.Format("{0}:{1}  |  ", Convert.ToString(item.Key), value);
            }

            menu += "F12:Sair  |";

            Console.SetCursorPosition(0, 25);
            Console.Write(menu);
        }
コード例 #17
0
    // Use this for initialization
    void Start()
    {
        deathListeners = new List <DeathListener> ();
        screenAction   = GameObject.Find("Screen").GetComponent <ScreenAction> ();
        playerSprite   = GetComponent <SpriteRenderer> ();
        playerControl  = GetComponent <PlayerControl> ();
//		playerAnimator = GetComponent<Animator> ();
        foreach (Transform child in this.gameObject.transform)
        {
            if (child.name == "Ghost")
            {
                ghosty = child.gameObject;
            }
        }
        if (isLocalPlayer)
        {
            hearts = new Image[maxHealth];
//			panel = GameObject.Find ("Canvas").transform.FindChild ("Player 0");
            for (int i = 0; i < maxHealth; i++)
            {
                hearts [i] = GameObject.Find("Heart" + (i + 1)).GetComponent <Image> ();
            }
//			playerAnimator = GetComponent<Animator> ();
//			playerSprite = GetComponent<SpriteRenderer> ();
//			foreach (Transform child in this.gameObject.transform) {
//				if (child.name == "Ghost") {
//					ghosty = child.gameObject;
//				}
//			}
        }
        else
        {
            // Need to actually use the
//			panel = GameObject.Find ("Canvas").transform.FindChild ("Player 0");
            return;
        }
//		healthBarBackground = panel.FindChild ("Health Background").GetComponent<RectTransform> ();
//		healthBar = healthBarBackground.FindChild ("Health Foreground").GetComponent<RectTransform> ();
        notificationText = GameObject.Find("Notice").GetComponent <NotificationText> ();
    }
コード例 #18
0
        public ActionResult ScreenAction([Bind(Include = "ActionId,FK_screenId,ActionName,ActionType")] ScreenAction screenAction)
        {
            //  _iRolesAPIController = new RolesAPIController();
            // if (ModelState.IsValid)
            {
                string action = ((ModelType)screenAction.ActionType).ToString();
                int    value;
                if (int.TryParse(action, out value))
                {
                    ResponseModel _result1 = new ResponseModel();

                    _result1.ResponseStatus = false;
                    _result1.ResponseText   = "Sorry, Action Type has some error.";
                    return(this.Json(_result1, JsonRequestBehavior.DenyGet));
                }


                // role.Active = true;
                ResponseModel _result = _screenAPIController.AddScreenAction(screenAction);
                //  return RedirectToAction("Index");
                if (_result.ResponseStatus)
                {
                    //return RedirectToAction("Index");
                    return(this.Json(_result, JsonRequestBehavior.DenyGet));
                }
                else
                {
                    if (Request.IsAjaxRequest())
                    {
                        return(this.Json(_result, JsonRequestBehavior.DenyGet));
                    }
                    else
                    {
                        return(View(screenAction));
                    }
                }
            }
            return(View(screenAction));
        }
コード例 #19
0
 public BindingExpression(string name, ScreenObjectRegistry registry)
 {
     _screenAction      = new ScreenAction();
     _screenAction.Name = name;
     _registry          = registry;
 }
コード例 #20
0
 private void register(ScreenAction screenAction)
 {
     _actions.Add(screenAction);
 }
コード例 #21
0
 public void EditScreenAction(ScreenAction screenAction)
 {
     _screenService.EditScreenAction(screenAction);
 }
コード例 #22
0
 public ResponseModel AddScreenAction(ScreenAction screenAction)
 {
     return(_screenService.AddScreenAction(screenAction));
 }
コード例 #23
0
        private void ActivateKeyboard()
        {
            bool end = false;

            do
            {
                ConsoleKeyInfo key = Console.ReadKey(true);

                ScreenAction action = null;
                if (m_keyAction.TryGetValue(key.Key, out action) && action.Presenter != null)
                {
                    action.Presenter.Show(m_instance);
                }
                else
                {
                    switch (key.Key)
                    {
                    case ConsoleKey.F1:
                    case ConsoleKey.F4:
                    case ConsoleKey.F6:
                    case ConsoleKey.F7:
                    case ConsoleKey.F8:
                    case ConsoleKey.F9:
                    case ConsoleKey.F10:
                    case ConsoleKey.F11:
                        break;

                    case ConsoleKey.F2:
                        if (m_presenter != null)
                        {
                            string msgErr = null;
                            if (!m_presenter.Save(out msgErr))
                            {
                                WriteMessageOnFooter(msgErr);
                            }
                            else if (m_presenter.ParentPresenter != null)
                            {
                                m_presenter.ParentPresenter.Show(m_instance);
                            }
                        }
                        break;

                    case ConsoleKey.F3:
                        if (m_presenter != null)
                        {
                            m_presenter.Search(m_instance);
                        }
                        break;

                    case ConsoleKey.F5:
                        if (m_presenter != null)
                        {
                            int    position = 0;
                            string value    = GetCurrentScreenItemValue();
                            if (!string.IsNullOrEmpty(value) && int.TryParse(value, out position))
                            {
                                m_presenter.SelectedItem(m_instance, position);
                            }
                        }
                        break;

                    case ConsoleKey.F12:
                        end = true;
                        break;

                    case ConsoleKey.UpArrow:
                        MoveToPreviousScreenItem();
                        break;

                    case ConsoleKey.Enter:
                    case ConsoleKey.DownArrow:
                        MoveToNextScreenItem();
                        break;

                    default:
                        ReadData(key);
                        break;
                    }
                }
            } while (!end);
        }
コード例 #24
0
 public void EditScreenAction(ScreenAction screenAction)
 {
     screenAction.CreatedDate = DateTime.Now;
     _screenRepository.EditScreenAction(screenAction);
 }
コード例 #25
0
 // add screenAction
 public ResponseModel AddScreenAction(ScreenAction screenAction)
 {
     return(_screenRepository.AddScreenAction(screenAction));
 }