Beispiel #1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="tableName"></param>
 /// <param name="editType"></param>
 public CommandStruct(string tableName, CommandMode editType)
 {
     TableName = tableName;
     EntityType = editType;
     Filter = new CommandFilter();
     Parameters = new IDataParameter[0];
 }
Beispiel #2
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="tableName"></param>
 /// <param name="editType"></param>
 /// <param name="columns">Inquiry table columns</param>
 /// <param name="filter"></param>
 public CommandStruct(string tableName, CommandMode editType, CommandFilter filter, string columns = "")
 {
     TableName = tableName;
     EntityType = editType;
     Columns = columns;
     Filter = filter;
     Parameters = new IDataParameter[0];
     CommandType = CommandType.Text;
 }
        public CommandModeTest()
        {
            _textView = CreateTextView();
            _textBuffer = _textView.TextBuffer;
            _vimBuffer = CreateVimBuffer(CreateVimBufferData(_textView));

            var factory = new MockRepository(MockBehavior.Strict);
            var commonOperations = CommonOperationsFactory.GetCommonOperations(_vimBuffer.VimBufferData);
            _modeRaw = new CommandMode(_vimBuffer, commonOperations);
            _mode = _modeRaw;
        }
Beispiel #4
0
        public void ExecuteSearch()
        {
            //Save into local variable to avoid unintentionally modifying the closure
            var text = StatusLine.Text;
            var message = Message.Build<IIsSearchable>(search => search.CommitSearch(text));

            MainGrid.RowDefinitions.ElementAt(1).Height = new GridLength(0);
            StatusLine.Text = "";
            _commandMode = CommandMode.Normal;

            message.Invoke(this);
        }
Beispiel #5
0
        public CommandModeTest()
        {
            _textView = CreateTextView();
            _textBuffer = _textView.TextBuffer;
            _vimBuffer = CreateVimBuffer(CreateVimBufferData(_textView));

            var factory = new MockRepository(MockBehavior.Strict);
            var commonOperations = CommonOperationsFactory.GetCommonOperations(_vimBuffer.VimBufferData);
            var interpreter = new Interpreter.Interpreter(
                _vimBuffer,
                commonOperations,
                factory.Create<IFoldManager>().Object,
                factory.Create<IFileSystem>().Object,
                factory.Create<IBufferTrackingService>().Object);
            _modeRaw = new CommandMode(_vimBuffer, commonOperations, interpreter);
            _mode = _modeRaw;
        }
Beispiel #6
0
        public void SetUp()
        {
            _factory = new MockRepository(MockBehavior.Strict);
            _selection = _factory.Create<ITextSelection>();
            _selection.Setup(x => x.IsEmpty).Returns(true);
            _operations = _factory.Create<ICommonOperations>();
            _buffer = EditorUtil.CreateTextBuffer();
            _caret = MockObjectFactory.CreateCaret(factory: _factory);
            _caret.SetupProperty(x => x.IsHidden);
            _textView = MockObjectFactory.CreateTextView(
                textBuffer: _buffer,
                caret: _caret.Object,
                selection: _selection.Object,
                factory: _factory);

            _bufferData = MockObjectFactory.CreateVimBuffer(textView: _textView.Object, factory: _factory);
            _processor = _factory.Create<ICommandProcessor>();
            _modeRaw = new CommandMode(_bufferData.Object, _processor.Object, _operations.Object);
            _mode = _modeRaw;
        }
Beispiel #7
0
        /// <summary>
        /// Generate the necessary parameters
        /// </summary>
        public List <KeyValuePair <string, string> > GetParams()
        {
            var p = new List <KeyValuePair <string, string> >();

            if (Command != null)
            {
                p.Add(new KeyValuePair <string, string>("Command", Command));
            }

            if (Sim != null)
            {
                p.Add(new KeyValuePair <string, string>("Sim", Sim));
            }

            if (CallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("CallbackMethod", CallbackMethod.ToString()));
            }

            if (CallbackUrl != null)
            {
                p.Add(new KeyValuePair <string, string>("CallbackUrl", Serializers.Url(CallbackUrl)));
            }

            if (CommandMode != null)
            {
                p.Add(new KeyValuePair <string, string>("CommandMode", CommandMode.ToString()));
            }

            if (IncludeSid != null)
            {
                p.Add(new KeyValuePair <string, string>("IncludeSid", IncludeSid));
            }

            if (DeliveryReceiptRequested != null)
            {
                p.Add(new KeyValuePair <string, string>("DeliveryReceiptRequested", DeliveryReceiptRequested.Value.ToString().ToLower()));
            }

            return(p);
        }
Beispiel #8
0
 private object FillIn(OdbcCommand oCmd, CommandMode cmdMode)
 {
     if (cmdMode == CommandMode.Execute)
     {
         return(oCmd.ExecuteNonQuery());
     }
     else if (cmdMode == CommandMode.GetDataSet)
     {
         DataSet         ds  = new DataSet();
         OdbcDataAdapter oDA = new OdbcDataAdapter(oCmd);
         oDA.Fill(ds);
         return(ds);
     }
     else if (cmdMode == CommandMode.GetDataTable)
     {
         DataTable       dt  = new DataTable();
         OdbcDataAdapter oDA = new OdbcDataAdapter(oCmd);
         oDA.Fill(dt);
         return(dt);
     }
     else if (cmdMode == CommandMode.GetValue)
     {
         return(oCmd.ExecuteScalar());
     }
     else if (cmdMode == CommandMode.HasRow)
     {
         oCmd.CommandText = String.Format("if exists({0})select 1; else select 0;", oCmd.CommandText);
         return(Convert.ToInt32(oCmd.ExecuteScalar()) == 1);
     }
     else if (cmdMode == CommandMode.Count)
     {
         oCmd.CommandText = String.Format("select count(*) from ({0}) as A", oCmd.CommandText);
         return(Convert.ToInt32(oCmd.ExecuteScalar()));
     }
     else if (cmdMode == CommandMode.DataReader)
     {
         return(oCmd.ExecuteReader());
     }
     return(null);
 }
Beispiel #9
0
        // Configuration:
        // "forcereason" - boolean; Force a reason to be given. Defaults to false.
        // "purgedays" - integer; Number of days of target's post history to delete, if banning.
        //               Must be between 0-7 inclusive. Defaults to 0.
        // "successmsg" - Message to display on command success. Overrides default.
        // "notifymsg" - Message to send to the target user being acted upon. Default message is used
        //               if the value is not specified. If a blank value is given, the feature is disabled.
        //               Takes the special values $s for server name and $r for reason text.
        protected BanKick(ModCommands l, string label, JObject conf, CommandMode mode) : base(l, label, conf)
        {
            _mode        = mode;
            _forceReason = conf["forcereason"]?.Value <bool>() ?? false;
            _purgeDays   = conf["purgedays"]?.Value <int>() ?? 0;
            if (_mode == CommandMode.Ban && (_purgeDays > 7 || _purgeDays < 0))
            {
                throw new RuleImportException("The value of 'purgedays' must be between 0 and 7.");
            }
            _successMsg = conf["successmsg"]?.Value <string>();
            if (conf["notifymsg"] == null)
            {
                // Message not specified - use default
                _notifyMsg = string.Format(NotifyDefault, mode == CommandMode.Ban ? "banned" : "kicked");
            }
            else
            {
                string val = conf["notifymsg"].Value <string>();
                if (string.IsNullOrWhiteSpace(val))
                {
                    _notifyMsg = null;                                 // empty value - disable message
                }
                else
                {
                    _notifyMsg = val;
                }
            }

            // Building usage message here
            DefaultUsageMsg = $"{this.Trigger} [user or user ID] " + (_forceReason ? "[reason]" : "*[reason]*") + "\n"
                              + "Removes the given user from this server"
                              + (_mode == CommandMode.Ban ? " and prevents the user from rejoining" : "") + ". "
                              + (_forceReason ? "L" : "Optionally l") + "ogs the reason for the "
                              + (_mode == CommandMode.Ban ? "ban" : "kick") + " to the Audit Log.";
            if (_purgeDays > 0)
            {
                DefaultUsageMsg += $"\nAdditionally removes the user's post history for the last {_purgeDays} day(s).";
            }
        }
    // キャラクター選択
    public void SelectDirectAttacker(GameObject attackCharacter)
    {
        currentCommand = CommandMode.SelectDirectAttacker;
        commandPanel.GetComponent <CanvasGroup>().interactable = false;
        selectedGameObjectStack.Push(EventSystem.current.currentSelectedGameObject);

        GameObject battleCharacterButtonIns;

        foreach (var enemy in enemyCharacterInBattleList)
        {
            battleCharacterButtonIns = Instantiate <GameObject>(battleCharacterButton, selectCharacterPanel);
            battleCharacterButtonIns.transform.Find("Text").GetComponent <Text>().text = enemy.gameObject.name;
            // 攻撃するキャラのDirectAttackスキルを取得する
            var   characterSkill = attackCharacter.GetComponent <CharacterBattleScript>().GetCharacterStatus().GetSkillList();
            Skill directAtatck   = characterSkill.Find(skill => skill.GetSkillType() == Skill.Type.DirectAttack);
            battleCharacterButtonIns.GetComponent <Button>().onClick.AddListener(() => SetSelectCommand(attackCharacter, directAtatck, enemy));
        }

        selectCharacterPanel.GetComponent <CanvasGroup>().interactable = true;
        EventSystem.current.SetSelectedGameObject(selectCharacterPanel.GetChild(0).gameObject);
        selectCharacterPanel.gameObject.SetActive(true);
    }
 //キャンセルボタンを押した時の処理
 public void OnClickCancelButton()
 {
     if (isStartTarn)
     {
         return;
     }
     if (currentCommand == CommandMode.SelectCommand)
     {
         commandPanel.gameObject.SetActive(false);
     }
     else
     {
         if (currentCommand == CommandMode.SelectDirectAttacker || currentCommand == CommandMode.SelectMagicTarget)
         {
             currentCommand = CommandMode.SelectCommand;
         }
         else
         {
             // magicOrItemPanelにボタンがあれば全て削除
             for (int i = magicOrItemPanelContent.transform.childCount - 1; i >= 0; i--)
             {
                 Destroy(magicOrItemPanelContent.transform.GetChild(i).gameObject);
             }
             magicOrItemPanel.GetComponent <CanvasGroup>().interactable = false;
             magicOrItemPanel.gameObject.SetActive(false);
             if (currentCommand == CommandMode.SelectItem)
             {
                 currentCommand = CommandMode.SelectCommand;
             }
             else if (currentCommand == CommandMode.SelectRecoveryItemTarget)
             {
                 currentCommand = CommandMode.SelectItem;
             }
         }
         ResetCharacterPanel();
         commandPanel.GetComponent <CanvasGroup>().interactable = true;
         EventSystem.current.SetSelectedGameObject(selectedGameObjectStack.Pop());
     }
 }
Beispiel #12
0
    // 選択したコマンドで処理分け
    public void SelectCommand(string command)
    {
        if (command == "Status")
        {
            currentCommand = CommandMode.StatusPanelSelectCharacter;
            // UIのオン・オフや選択アイコンの設定
            commandPanelCanvasGroup.interactable = false;
            selectedGameObjectStack.Push(EventSystem.current.currentSelectedGameObject);

            GameObject characterButtonIns;

            // パーティーメンバー分のボタンを作成
            foreach (var member in partyStatus.GetAllyStatus())
            {
                characterButtonIns = Instantiate <GameObject>(characterPanelButtonPrefab, selectCharacterPanel.transform);
                characterButtonIns.GetComponentInChildren <Text>().text = member.GetCharacterName();
                characterButtonIns.GetComponent <Button>().onClick.AddListener(() => ShowStatus(member));
            }
        }
        else if (command == "Item")
        {
            currentCommand = CommandMode.ItemPanelSelectCharacter;
            statusPanel.SetActive(false);
            commandPanelCanvasGroup.interactable = false;
            selectedGameObjectStack.Push(EventSystem.current.currentSelectedGameObject);

            GameObject characterButtonIns;


            characterButtonIns = Instantiate <GameObject>(characterPanelButtonPrefab, selectCharacterPanel.transform);
            characterButtonIns.GetComponentInChildren <Text>().text = "ふくろ";
            characterButtonIns.GetComponent <Button>().onClick.AddListener(() => CreateItemPanelButton(yusyaStatus));
        }
        // 階層を一番最後に並べ替え
        selectCharacterPanel.transform.SetAsLastSibling();
        selectCharacterPanel.SetActive(true);
        selectCharacterPanelCanvasGroup.interactable = true;
        EventSystem.current.SetSelectedGameObject(selectCharacterPanel.transform.GetChild(0).gameObject);
    }
    // 使用する魔法の選択
    public void SelectMagic(GameObject character)
    {
        currentCommand = CommandMode.SelectMagic;
        commandPanel.GetComponent <CanvasGroup>().interactable = false;
        selectedGameObjectStack.Push(EventSystem.current.currentSelectedGameObject);

        GameObject battleMagicPanelButtonIns;
        var        skillList = character.GetComponent <CharacterBattle>().GetCharacterStatus().GetSkillList();


        foreach (var skill in skillList)
        {
            if (skill.GetSkillType() == Skill.Type.MagicAttack ||
                skill.GetSkillType() == Skill.Type.RecoveryMagic ||
                skill.GetSkillType() == Skill.Type.IncreaseAttackPowerMagic ||
                skill.GetSkillType() == Skill.Type.IncreaseDefencePowerMagic
                )
            {
                battleMagicPanelButtonIns = Instantiate <GameObject>(battleMagicPanelButton, magicOrItemPanelContent);
                battleMagicPanelButtonIns.transform.Find("MagicName").GetComponent <Text>().text = skill.GetKanjiName();
                battleMagicPanelButtonIns.transform.Find("AmountToUseMagicPoints").GetComponent <Text>().text = ((Magic)skill).GetAmountToUseMagicPoints().ToString();


                // MPが足りない時はボタンを押しても何もせず魔法の名前を暗くする
                if (character.GetComponent <CharacterBattle>().GetMp() < ((Magic)skill).GetAmountToUseMagicPoints())
                {
                    battleMagicPanelButtonIns.transform.Find("MagicName").GetComponent <Text>().color = new Color(0.4f, 0.4f, 0.4f);
                }
                else
                {
                    battleMagicPanelButtonIns.GetComponent <Button>().onClick.AddListener(() => SelectUseMagicTarget(character, skill));
                }
            }
        }

        magicOrItemPanel.GetComponent <CanvasGroup>().interactable = true;
        EventSystem.current.SetSelectedGameObject(magicOrItemPanelContent.GetChild(0).gameObject);
        magicOrItemPanel.gameObject.SetActive(true);
    }
    //アイテムを使用するキャラクターを選択する
    public void UseItem(AllyStatus allyStatus, Item item)
    {
        useItemPanelCanvasGroup.interactable = false;
        useItemSelectCharacterPanel.SetActive(true);
        //UseItemPanelでどれを最後に選択していたか
        selectedGameObjectStack.Push(EventSystem.current.currentSelectedGameObject);

        GameObject characterButtonIns;

        //パーティメンバー分のボタンを作成
        foreach (var member in partyStatus.GetAllyStatus())
        {
            characterButtonIns = Instantiate <GameObject>(characterPanelButtonPrefab, useItemSelectCharacterPanel.transform);
            characterButtonIns.GetComponentInChildren <Text>().text = member.GetCharacterName();
            characterButtonIns.GetComponent <Button>().onClick.AddListener(() => UseItemToCharacter(allyStatus, member, item));
        }
        //UseItemSelectCharacterPanelに移行する
        currentCommand = CommandMode.UseItemSelectCharacterPanel;
        useItemSelectCharacterPanel.transform.SetAsLastSibling();
        EventSystem.current.SetSelectedGameObject(useItemSelectCharacterPanel.transform.GetChild(0).gameObject);
        useItemSelectCharacterPanelCanvasGroup.interactable = true;
        Input.ResetInputAxes();
    }
    // アイテムを使用するキャラクターを選択する
    public void UseItem(Item item)
    {
        useItemPanelCanvasGroup.interactable = false;
        useItemSelectCharacterPanel.SetActive(true);
        // UseItemPanelでどれを最後に選択していたか
        selectedGameObjectStack.Push(EventSystem.current.currentSelectedGameObject);

        GameObject characterButtonIns;

        // パーティメンバー分のボタンを作成
        foreach (var member in partyStatus.GetAllyStatus())
        {
            characterButtonIns = Instantiate <GameObject>(characterPanelButtonPrefab, useItemSelectCharacterPanel.transform);
            characterButtonIns.GetComponentInChildren <Text>().text = member.GetCharacterName();
            characterButtonIns.GetComponent <Button>().onClick.AddListener(() => UseItemToCharacter(member, item));
        }
        characterButtonIns = Instantiate <GameObject>(characterPanelButtonPrefab, useItemSelectCharacterPanel.transform);
        characterButtonIns.GetComponentInChildren <Text>().text = "やめる";
        characterButtonIns.GetComponent <Button>().onClick.AddListener(() => OnCancelButton());
        // UseItemSelectCharacterPanelに移行する
        currentCommand = CommandMode.UseItemSelectCharacterPanel;
        useItemSelectCharacterPanelCanvasGroup.interactable = true;
    }
    // 使用するアイテムの選択
    public void SelectItem(GameObject character)
    {
        var itemDictionary = ((AllyStatus)yusyaObjct.GetComponent <CharacterBattle>().GetCharacterStatus()).GetItemDictionary();

        GameObject battleItemPanelButtonIns;

        foreach (var item in itemDictionary.Keys)
        {
            if (item.GetItemType() == Item.Type.HPRecovery ||
                item.GetItemType() == Item.Type.MPRecovery ||
                item.GetItemType() == Item.Type.ParalyzeRecovery ||
                item.GetItemType() == Item.Type.PoisonRecovery ||
                item.GetItemType() == Item.Type.SilentRecovery
                )
            {
                battleItemPanelButtonIns = Instantiate <GameObject>(battleItemPanelButton, magicOrItemPanelContent);
                battleItemPanelButtonIns.transform.Find("ItemName").GetComponent <Text>().text = item.GetKanjiName();
                battleItemPanelButtonIns.transform.Find("Num").GetComponent <Text>().text      = ((AllyStatus)character.GetComponent <CharacterBattle>().GetCharacterStatus()).GetItemNum(item).ToString();
                battleItemPanelButtonIns.GetComponent <Button>().onClick.AddListener(() => SelectItemTarget(character, item));
            }
        }

        if (magicOrItemPanelContent.childCount > 0)
        {
            currentCommand = CommandMode.SelectItem;
            commandPanel.GetComponent <CanvasGroup>().interactable = false;
            selectedGameObjectStack.Push(EventSystem.current.currentSelectedGameObject);

            magicOrItemPanel.GetComponent <CanvasGroup>().interactable = true;
            EventSystem.current.SetSelectedGameObject(magicOrItemPanelContent.GetChild(0).gameObject);
            magicOrItemPanel.gameObject.SetActive(true);
        }
        else
        {
            ShowMessage("使えるアイテムがありません。");
        }
    }
    //装備を外す
    public void RemoveEquip(AllyStatus allyStatus, Item item)
    {
        //アイテムの種類に応じて装備を外す
        if (item.GetItemType() == Item.Type.ArmorAll ||
            item.GetItemType() == Item.Type.ArmorUnityChan ||
            item.GetItemType() == Item.Type.ArmorYuji)
        {
            var equipArmorButton = itemPanelButtonList.Find(itemPanelButton => itemPanelButton.transform.Find("ItemName").GetComponent <Text>().text == item.GetKanjiName());
            equipArmorButton.transform.Find("Equip").GetComponent <Text>().text = "";
            allyStatus.SetEquipArmor(null);
        }
        else if (item.GetItemType() == Item.Type.WeaponAll ||
                 item.GetItemType() == Item.Type.WeaponUnityChan ||
                 item.GetItemType() == Item.Type.WeaponYuji)
        {
            var equipArmorButton = itemPanelButtonList.Find(itemPanelButton => itemPanelButton.transform.Find("ItemName").GetComponent <Text>().text == item.GetKanjiName());
            equipArmorButton.transform.Find("Equip").GetComponent <Text>().text = "";
            allyStatus.SetEquipWeapon(null);
        }
        //装備を外した旨を表示
        useItemInformationPanel.GetComponentInChildren <Text>().text = allyStatus.GetCharacterName() + "は" + item.GetKanjiName() + "を外しました。";
        //装備を外したらItemPanelに戻る処理
        useItemPanelCanvasGroup.interactable = false;
        useItemPanel.SetActive(false);
        itemPanelCanvasGroup.interactable = true;
        //ItemPanelに戻るのでUseItemPanelの子要素のボタンを全削除
        for (int i = useItemPanel.transform.childCount - 1; i >= 0; i--)
        {
            Destroy(useItemPanel.transform.GetChild(i).gameObject);
        }

        useItemInformationPanel.transform.SetAsLastSibling();
        useItemInformationPanel.SetActive(true);

        currentCommand = CommandMode.UseItemPanelToItemPanel;
        Input.ResetInputAxes();
    }
    // アイテムを使用する相手を選択
    public void SelectItemTarget(GameObject user, Item item)
    {
        currentCommand = CommandMode.SelectRecoveryItemTarget;
        magicOrItemPanel.GetComponent <CanvasGroup>().interactable = false;
        selectedGameObjectStack.Push(EventSystem.current.currentSelectedGameObject);

        GameObject battleCharacterButtonIns;

        // 使用するキャラのItemスキルを取得する
        var   characterSkill = user.GetComponent <CharacterBattleScript>().GetCharacterStatus().GetSkillList();
        Skill useItem        = characterSkill.Find(skill => skill.GetSkillType() == Skill.Type.Item);

        foreach (var allyCharacter in allyCharacterInBattleList)
        {
            battleCharacterButtonIns = Instantiate <GameObject>(battleCharacterButton, selectCharacterPanel);
            battleCharacterButtonIns.transform.Find("Text").GetComponent <Text>().text = allyCharacter.gameObject.name;
            battleCharacterButtonIns.GetComponent <Button>().onClick.AddListener(() => SetSelectCommand(user, useItem, allyCharacter, item));  //回復アイテムのみ
            //battleCharacterButtonIns.GetComponent<Button>().onClick.AddListener(() => UseItem(user, allyCharacter, item));
        }

        selectCharacterPanel.GetComponent <CanvasGroup>().interactable = true;
        EventSystem.current.SetSelectedGameObject(selectCharacterPanel.GetChild(0).gameObject);
        selectCharacterPanel.gameObject.SetActive(true);
    }
Beispiel #19
0
    void Awake()
    {
        // コマンド画面を開く処理をしているUnityChanCommandScriptを取得
        yusyaCommand = GameObject.FindWithTag("Player").GetComponent <YusyaCommand>();
        // 現在のコマンドを初期化
        currentCommand = CommandMode.CommandPanel;
        // 階層を辿ってを取得
        firstSelectButton = transform.Find("CommandPanel/StatusButton").gameObject;
        // パネル系
        commandPanel         = transform.Find("CommandPanel").gameObject;
        statusPanel          = transform.Find("StatusPanel").gameObject;
        selectCharacterPanel = transform.Find("SelectCharacterPanel").gameObject;
        // CanvasGroup
        commandPanelCanvasGroup         = commandPanel.GetComponent <CanvasGroup>();
        selectCharacterPanelCanvasGroup = selectCharacterPanel.GetComponent <CanvasGroup>();
        // ステータス用テキスト
        characterNameText = statusPanel.transform.Find("CharacterNamePanel/Text").GetComponent <Text>();
        statusTitleText   = statusPanel.transform.Find("StatusParamPanel/Title").GetComponent <Text>();
        statusParam1Text  = statusPanel.transform.Find("StatusParamPanel/Param1").GetComponent <Text>();
        statusParam2Text  = statusPanel.transform.Find("StatusParamPanel/Param2").GetComponent <Text>();

        itemPanel    = transform.Find("ItemPanel").gameObject;
        content      = itemPanel.transform.Find("Mask/Content").gameObject;
        useItemPanel = transform.Find("UseItemPanel").gameObject;
        useItemSelectCharacterPanel = transform.Find("UseItemSelectCharacterPanel").gameObject;
        itemInformationPanel        = transform.Find("ItemInformationPanel").gameObject;
        useItemInformationPanel     = transform.Find("UseItemInformationPanel").gameObject;

        itemPanelCanvasGroup    = itemPanel.GetComponent <CanvasGroup>();
        useItemPanelCanvasGroup = useItemPanel.GetComponent <CanvasGroup>();
        useItemSelectCharacterPanelCanvasGroup = useItemSelectCharacterPanel.GetComponent <CanvasGroup>();

        // 情報表示用テキスト
        informationTitleText = itemInformationPanel.transform.Find("Title").GetComponent <Text>();
        informationText      = itemInformationPanel.transform.Find("Information").GetComponent <Text>();
    }
Beispiel #20
0
        /// <summary>
        /// Generate the necessary parameters
        /// </summary>
        public List <KeyValuePair <string, string> > GetParams()
        {
            var p = new List <KeyValuePair <string, string> >();

            if (Command != null)
            {
                p.Add(new KeyValuePair <string, string>("Command", Command));
            }

            if (Sim != null)
            {
                p.Add(new KeyValuePair <string, string>("Sim", Sim));
            }

            if (CallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("CallbackMethod", CallbackMethod.ToString()));
            }

            if (CallbackUrl != null)
            {
                p.Add(new KeyValuePair <string, string>("CallbackUrl", CallbackUrl.AbsoluteUri));
            }

            if (CommandMode != null)
            {
                p.Add(new KeyValuePair <string, string>("CommandMode", CommandMode.ToString()));
            }

            if (IncludeSid != null)
            {
                p.Add(new KeyValuePair <string, string>("IncludeSid", IncludeSid));
            }

            return(p);
        }
Beispiel #21
0
 /// <summary>
 /// 创建CommandStruct对象
 /// </summary>
 /// <param name="tableName"></param>
 /// <param name="editType"></param>
 /// <param name="columns"></param>
 /// <returns></returns>
 public override CommandStruct CreateCommandStruct(string tableName, CommandMode editType, string columns)
 {
     return new CommandStruct(tableName, editType, columns);
 }
Beispiel #22
0
 public void EnterSearchMode()
 {
     MainGrid.RowDefinitions.ElementAt(1).Height = new GridLength(20);
     StatusLine.Text = "/";
     _commandMode = CommandMode.Search;
 }
Beispiel #23
0
        /// <summary>
        /// Run a command and return the output as a string, optionally comparing
        /// it to a comparison file containing expected output. Input to the command
        /// is taken from an (optional) input file containing one entry per line
        /// </summary>
        /// <param name="factory"></param>
        /// <param name="arguments"></param>
        /// <param name="command"></param>
        /// <param name="mode"></param>
        /// <param name="historyFile"></param>
        /// <param name="settingsFile"></param>
        /// <param name="inputFile"></param>
        /// <param name="comparisonFile"></param>
        /// <param name="skipLines"></param>
        /// <returns></returns>
        public static string RunCommand(NatureRecorderFactory factory,
                                        string[] arguments,
                                        CommandBase command,
                                        CommandMode mode,
                                        string historyFile,
                                        string settingsFile,
                                        string inputFile,
                                        string comparisonFile,
                                        int skipLines)
        {
            string       data;
            StreamReader input = null;

            // Open the input file, if specified
            if (!string.IsNullOrEmpty(inputFile))
            {
                string commandFilePath = Path.Combine(_currentFolder, "Content", inputFile);
                input = new StreamReader(commandFilePath);
            }

            // Run the command, capturing the output
            using (MemoryStream stream = new MemoryStream())
            {
                using (StreamWriter output = new StreamWriter(stream))
                {
                    // Load user settings, if required
                    UserSettings settings = null;
                    if (!string.IsNullOrEmpty(settingsFile))
                    {
                        settings = new UserSettings(settingsFile);
                        settings.Load();
                    }

                    //  Run the command
                    command.Run(new CommandContext
                    {
                        Factory   = factory,
                        Mode      = mode,
                        Arguments = arguments ?? new string[] { },
                        Reader    = (input != null) ? new StreamCommandReader(input) : null,
                        Output    = output,
                        History   = (!string.IsNullOrEmpty(historyFile)) ? new CommandHistory(historyFile) : null,
                        Settings  = settings
                    });

                    data = TestHelpers.ReadStream(stream);
                }
            }

            // Close the input file
            if (input != null)
            {
                input.Dispose();
            }

            // Compare the output to the comparison file, if specified
            if (!string.IsNullOrEmpty(comparisonFile))
            {
                TestHelpers.CompareOutput(data, comparisonFile, skipLines);
            }

            return(data);
        }
    //渡す相手を指定しアイテム数の増減をする
    public void PassItemToOtherCharacter(AllyStatus fromChara, AllyStatus toChara, Item item)
    {
        useItemInformationPanel.SetActive(true);
        useItemSelectCharacterPanelCanvasGroup.interactable = false;
        useItemSelectCharacterPanel.SetActive(false);

        //持っているアイテム数を減らす
        fromChara.SetItemNum(item, fromChara.GetItemNum(item) - 1);
        //渡されたキャラクターがアイテムを持っていなければそのアイテムを登録
        if (!toChara.GetItemDictionary().ContainsKey(item))
        {
            toChara.SetItemDictionary(item, 0);
        }
        //渡されたキャラクターのアイテム数を増やす
        toChara.SetItemNum(item, toChara.GetItemNum(item) + 1);
        //アイテムを渡し終わったらアイテムを渡す相手のUseItemSelectCharacterPanelの子要素のボタンを全削除
        for (int i = useItemSelectCharacterPanel.transform.childCount - 1; i >= 0; i--)
        {
            Destroy(useItemSelectCharacterPanel.transform.GetChild(i).gameObject);
        }
        //itemPanleButtonListから該当するアイテムを探し数を更新する
        var itemButton = itemPanelButtonList.Find(obj => obj.transform.Find("ItemName").GetComponent <Text>().text == item.GetKanjiName());

        itemButton.transform.Find("Num").GetComponent <Text>().text = fromChara.GetItemNum(item).ToString();
        //アイテムを渡した旨を表示
        useItemInformationPanel.GetComponentInChildren <Text>().text = fromChara.GetCharacterName() + "は" + item.GetKanjiName() + "を" + toChara.GetCharacterName() + "に渡しました。";

        //アイテム数が0だったらボタンとキャラクターステータスからアイテムを削除
        if (fromChara.GetItemNum(item) == 0)
        {
            //装備している武器や鎧だったら装備を外す
            if (fromChara.GetEquipArmor() == item)
            {
                fromChara.SetEquipArmor(null);
            }
            else if (fromChara.GetEquipWeapon() == item)
            {
                fromChara.SetEquipWeapon(null);
            }
            //アイテムが0になったら一気にItemPanelに戻す為、UseItemPanel内とUseItemSelectCharacterPanel内でのオブジェクト登録を削除
            selectedGameObjectStack.Pop();
            selectedGameObjectStack.Pop();
            //itemPanelButtonListからアイテムパネルボタンを削除
            itemPanelButtonList.Remove(itemButton);
            //アイテムパネルボタン自身の削除
            Destroy(itemButton);
            //アイテムを渡したキャラクター自身のItemDictionaryからそのアイテムを削除
            fromChara.GetItemDictionary().Remove(item);
            //ItemPanelに戻る為、UseItemPanel内に作ったボタンを全削除
            for (int i = useItemPanel.transform.childCount - 1; i >= 0; i--)
            {
                Destroy(useItemPanel.transform.GetChild(i).gameObject);
            }
            //アイテム数が0になったのでCommandMode.NoItemPassedに変更
            currentCommand = CommandMode.NoItemPassed;
            useItemInformationPanel.transform.SetAsLastSibling();
            Input.ResetInputAxes();
        }
        else
        {
            //アイテム数が残っている場合はUseItemPanelでアイテムをどうするかの選択に戻る
            currentCommand = CommandMode.UseItemSelectCharacterPanelToUseItemPanel;
            useItemInformationPanel.transform.SetAsLastSibling();
            Input.ResetInputAxes();
        }
    }
Beispiel #25
0
        public Store.Common.MessageInfo ManageClient(Store.Client.BusinessObject.Client objClient, CommandMode cmdMode)
        {
            string          SQL       = "";
            ParameterList   paramList = new ParameterList();
            DataTableReader dr;

            Store.Common.MessageInfo objMessageInfo = null;
            try
            {
                SQL = "USP_ManageClient";
                paramList.Add(new SQLParameter("@ClientID", objClient.ClientID));
                paramList.Add(new SQLParameter("@ClientName", objClient.ClientName));
                paramList.Add(new SQLParameter("@ClientDisplayName", objClient.ClientDisplayName));
                paramList.Add(new SQLParameter("@Address", objClient.Address));
                paramList.Add(new SQLParameter("@CityID", objClient.CityID));
                paramList.Add(new SQLParameter("@StateID", objClient.StateID));
                paramList.Add(new SQLParameter("@CountryID", objClient.CountryID));
                paramList.Add(new SQLParameter("@PinID", objClient.PinID));
                if (cmdMode == CommandMode.N)
                {
                    paramList.Add(new SQLParameter("@UserId", objClient.CreatedBy));
                }
                else
                {
                    paramList.Add(new SQLParameter("@UserId", objClient.ModifiedBy));
                }
                paramList.Add(new SQLParameter("@ReferenceID", objClient.ReferenceID));
                paramList.Add(new SQLParameter("@IsActive", objClient.IsActive));
                paramList.Add(new SQLParameter("@CMDMode", cmdMode));
                dr = ExecuteQuery.ExecuteReader(SQL, paramList);
                if (dr.Read())
                {
                    objMessageInfo = new Store.Common.MessageInfo();
                    //objMessageInfo = new Pareeksha.Common.MessageInfo();
                    objMessageInfo.ErrorCode    = Convert.ToInt32(dr["ErrorCode"]);
                    objMessageInfo.ErrorMessage = Convert.ToString(dr["ErrorMessage"]);
                    objMessageInfo.TranID       = Convert.ToInt32(dr["TranID"]);
                    objMessageInfo.TranCode     = Convert.ToString(dr["TranCode"]);
                    objMessageInfo.TranMessage  = Convert.ToString(dr["TranMessage"]);
                }
            }
            catch (Exception ex)
            {
                Store.Common.Utility.ExceptionLog.Exceptionlogs(ex.Message, Store.Common.Utility.ExceptionLog.LineNumber(ex), typeof(Client).FullName, 1);
            }
            return(objMessageInfo);
        }
    //キャラクターのステータス表示
    public void ShowStatus(AllyStatus allyStatus)
    {
        currentCommand = CommandMode.StatusPanel;
        statusPanel.SetActive(true);
        //キャラクターの名前を表示
        characterNameText.text = allyStatus.GetCharacterName();

        //タイトルの表示
        var text = "レベル\n";

        text += "HP\n";
        text += "MP\n";
        text += "経験値\n";
        text += "状態異常\n";
        text += "力\n";
        text += "素早さ\n";
        text += "打たれ強さ\n";
        text += "魔法力\n";
        text += "装備武器\n";
        text += "装備鎧\n";
        text += "攻撃力\n";
        text += "防御力\n";
        statusTitleText.text = text;

        //HPとMPのDivision記号の表示
        text  = "\n";
        text += allyStatus.GetHp() + "\n";
        text += allyStatus.GetMp() + "\n";
        statusParam1Text.text = text;

        //ステータスパラメータの表示
        text  = allyStatus.GetLevel() + "\n";
        text += allyStatus.GetMaxHp() + "\n";
        text += allyStatus.GetMaxMp() + "\n";
        text += allyStatus.GetEarnedExperience() + "\n";
        if (!allyStatus.IsPoisonState() && !allyStatus.IsNumbnessState())
        {
            text += "正常";
        }
        else
        {
            if (allyStatus.IsPoisonState())
            {
                text += "毒";
                if (allyStatus.IsNumbnessState())
                {
                    text += "、痺れ";
                }
            }
            else
            {
                if (allyStatus.IsNumbnessState())
                {
                    text += "痺れ";
                }
            }
        }

        text += "\n";
        text += allyStatus.GetPower() + "\n";
        text += allyStatus.GetAgility() + "\n";
        text += allyStatus.GetStrikingStrength() + "\n";
        text += allyStatus.GetMagicPower() + "\n";
        text += allyStatus?.GetEquipWeapon()?.GetKanjiName() ?? "";
        text += "\n";
        text += allyStatus.GetEquipArmor()?.GetKanjiName() ?? "";
        text += "\n";
        text += allyStatus.GetPower() + (allyStatus.GetEquipWeapon()?.GetAmount() ?? 0) + "\n";
        text += allyStatus.GetStrikingStrength() + (allyStatus.GetEquipArmor()?.GetAmount() ?? 0) + "\n";
        statusParam2Text.text = text;
    }
Beispiel #27
0
 public override CommandStruct CreateCommandStruct(string tableName, CommandMode editType)
 {
     return new MySqlCommandStruct(tableName, editType);
 }
Beispiel #28
0
 /// <summary>
 /// 创建CommandStruct对象
 /// </summary>
 /// <param name="tableName"></param>
 /// <param name="editType"></param>
 /// <param name="columns"></param>
 /// <returns></returns>
 public override CommandStruct CreateCommandStruct(string tableName, CommandMode editType, string columns = "")
 {
     return(new MySqlCommandStruct(tableName, editType, columns));
 }
Beispiel #29
0
        /// <summary>
        /// Runs the specified command on the database.
        /// </summary>
        /// <typeparam name="TReturn">Type to be returned.</typeparam>
        /// <param name="command">Command to run</param>
        /// <param name="param">Optional param object (can be anonymous)</param>
        /// <param name="mode">Specify 'Write' to run the command transactioned.</param>
        /// <returns>Result of the query</returns>
        public IEnumerable <TReturn> RunCommand <TReturn>(string command, object param, CommandMode mode)
        {
            SqlConnection  connection  = null;
            SqlTransaction transaction = null;

            command = this.BuildCommand(command, useSpecifiedDatabase: true);

            try
            {
                connection = this.OpenConnection();
                if (mode == CommandMode.Write)
                {
                    transaction = connection.BeginTransaction();
                }

                var result = connection.Query <TReturn>(
                    sql: command,
                    param: param,
                    transaction: mode == CommandMode.Write ? transaction : null
                    );

                if (mode == CommandMode.Write)
                {
                    transaction.Commit();
                }

                return(result);
            }
            catch (Exception e)
            {
                if (mode == CommandMode.Write && transaction != null)
                {
                    transaction.Rollback();
                }

                throw new QueryException(
                          $"Failed to execute query.", e);
            }
            finally
            {
                if (connection != null)
                {
                    if (mode == CommandMode.Write && transaction != null)
                    {
                        transaction.Dispose();
                    }
                    connection.Dispose();
                }
            }
        }
Beispiel #30
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            if (DragElement == null &&
                command != CommandMode.MarqueSelection &&
                (currentButtons & MouseButtons.Right) != 0)
            {
                if (currentButtons == MouseButtons.Right)
                    command = CommandMode.TranslateView;
                else
                if (currentButtons == (MouseButtons.Right | MouseButtons.Left))
                    command = CommandMode.ScaleView;
            }

            Point currentLocation;
            PointF transformed_location;
            if (abortDrag)
            {
                transformed_location = originalLocation;

                var points = new PointF[] { originalLocation };
                transformation.TransformPoints(points);
                currentLocation = new Point((int)points[0].X, (int)points[0].Y);
            } else
            {
                currentLocation = e.Location;

                var points = new PointF[] { currentLocation };
                inverse_transformation.TransformPoints(points);
                transformed_location = points[0];
            }

            var deltaX = (lastLocation.X - currentLocation.X) / zoom;
            var deltaY = (lastLocation.Y - currentLocation.Y) / zoom;

            bool needRedraw = false;
            switch (command)
            {
                case CommandMode.ScaleView:
                    if (!mouseMoved)
                    {
                        if ((Math.Abs(deltaY) > 1))
                            mouseMoved = true;
                    }

                    if (mouseMoved &&
                        (Math.Abs(deltaY) > 0))
                    {
                        zoom *= (float)Math.Pow(2, deltaY / 100.0f);
                        Cursor.Position = this.PointToScreen(lastLocation);
                        snappedLocation = //lastLocation =
                            currentLocation;
                        this.Refresh();
                    }
                    return;
                case CommandMode.TranslateView:
                {
                    if (!mouseMoved)
                    {
                        if ((Math.Abs(deltaX) > 1) ||
                            (Math.Abs(deltaY) > 1))
                            mouseMoved = true;
                    }

                    if (mouseMoved &&
                        (Math.Abs(deltaX) > 0) ||
                        (Math.Abs(deltaY) > 0))
                    {
                        translation.X -= deltaX * zoom;
                        translation.Y -= deltaY * zoom;
                        snappedLocation = lastLocation = currentLocation;
                        this.Refresh();
                    }
                    return;
                }
                case CommandMode.MarqueSelection:
                    if (!mouseMoved)
                    {
                        if ((Math.Abs(deltaX) > 1) ||
                            (Math.Abs(deltaY) > 1))
                            mouseMoved = true;
                    }

                    if (mouseMoved &&
                        (Math.Abs(deltaX) > 0) ||
                        (Math.Abs(deltaY) > 0))
                    {
                        var marque_rectangle = GetMarqueRectangle();

                        foreach (var node in selectedNodes)
                            SetFlag(node, RenderState.Focus, false, false);

                        foreach (var node in unselectedNodes)
                            SetFlag(node, RenderState.Focus, true, false);

                        if (!abortDrag)
                        {
                            foreach (var node in graphNodes)
                            {
                                if (marque_rectangle.Contains(node.bounds))
                                {
                                    if ((node.state & RenderState.Focus) == 0 &&
                                        (ModifierKeys != Keys.Alt))
                                    {
                                        SetFlag(node, RenderState.Focus, true, false);
                                        selectedNodes.Add(node);
                                    }
                                    if ((node.state & RenderState.Focus) != 0 &&
                                        (ModifierKeys == Keys.Alt))
                                    {
                                        SetFlag(node, RenderState.Focus, false, false);
                                        unselectedNodes.Add(node);
                                    }
                                } else
                                {
                                    if ((node.state & RenderState.Focus) == RenderState.Focus &&
                                        (ModifierKeys == Keys.None))
                                    {
                                        SetFlag(node, RenderState.Focus, false, false);
                                        unselectedNodes.Add(node);
                                    }
                                }
                            }
                        }

                        snappedLocation = lastLocation = currentLocation;
                        this.Refresh();
                    }
                    return;

                default:
                case CommandMode.Edit:
                    break;
            }

            if (dragging)
            {
                if (!mouseMoved)
                {
                    if ((Math.Abs(deltaX) > 1) ||
                        (Math.Abs(deltaY) > 1))
                        mouseMoved = true;
                }

                if (mouseMoved &&
                    (Math.Abs(deltaX) > 0) ||
                    (Math.Abs(deltaY) > 0))
                {
                    mouseMoved = true;
                    if (DragElement != null)
                    {
                        BringElementToFront(DragElement);
                        switch (DragElement.ElementType)
                        {
                            case ElementType.NodeSelection:		// drag nodes
                            {
                                var selection = DragElement as NodeSelection;
                                foreach (var node in selection.Nodes)
                                {
                                    node.Location = new Point(	(int)Math.Round(node.Location.X - deltaX),
                                                                (int)Math.Round(node.Location.Y - deltaY));
                                }
                                snappedLocation = lastLocation = currentLocation;
                                this.Refresh();
                                return;
                            }
                            case ElementType.Node:				// drag single node
                            {
                                var node = DragElement as Node;
                                node.Location	= new Point((int)Math.Round(node.Location.X - deltaX),
                                                            (int)Math.Round(node.Location.Y - deltaY));
                                snappedLocation = lastLocation = currentLocation;
                                this.Refresh();
                                return;
                            }
                            case ElementType.NodeItem:			// drag in node-item
                            {
                                var nodeItem = DragElement as NodeItem;
                                needRedraw		= nodeItem.OnDrag(transformed_location);
                                snappedLocation = lastLocation = currentLocation;
                                break;
                            }
                            case ElementType.Connection:		// start dragging end of connection to new input connector
                            {
                                BringElementToFront(DragElement);
                                var connection			= DragElement as NodeConnection;
                                var outputConnector		= connection.From;
                                FocusElement			= outputConnector.Node;
                                if (Disconnect(connection))
                                {
                                    DragElement	= outputConnector;
                                } else
                                    DragElement = null;

                                goto case ElementType.OutputConnector;
                            }
                            case ElementType.InputConnector:	// drag connection from input or output connector
                            case ElementType.OutputConnector:
                            {
                                snappedLocation = lastLocation = currentLocation;
                                needRedraw = true;
                                break;
                            }
                        }
                    }
                }
            }

            NodeConnector destinationConnector = null;
            IElement draggingOverElement = null;
            var element = FindElementAt(transformed_location);
            if (element != null)
            {
                switch (element.ElementType)
                {
                    default:
                        if (DragElement != null)
                            element = null;
                        break;

                    case ElementType.NodeItem:
                    {
                        var item = element as NodeItem;
                        if (DragElement != null)
                        {
                            element = item.Node;
                            goto case ElementType.Node;
                        }
                        break;
                    }
                    case ElementType.Node:
                    {
                        var node = element as Node;
                        if (DragElement != null)
                        {
                            if (DragElement.ElementType == ElementType.InputConnector)
                            {
                                var dragConnector = DragElement as NodeConnector;
                                if (node.outputConnectors.Count == 1)
                                {
                                    element = node.outputConnectors[0];
                                    goto case ElementType.OutputConnector;
                                }

                                if (node != dragConnector.Node)
                                    draggingOverElement = node;
                            } else
                            if (DragElement.ElementType == ElementType.OutputConnector)
                            {
                                var dragConnector = DragElement as NodeConnector;
                                if (node.inputConnectors.Count == 1)
                                {
                                    element = node.inputConnectors[0];
                                    goto case ElementType.InputConnector;
                                }

                                if (node != dragConnector.Node)
                                    draggingOverElement = node;
                            }

                            //element = null;
                        }
                        break;
                    }
                    case ElementType.InputConnector:
                    case ElementType.OutputConnector:
                    {
                        destinationConnector = element as NodeConnector;

                        if (DragElement != null &&
                            (DragElement.ElementType == ElementType.InputConnector ||
                             DragElement.ElementType == ElementType.OutputConnector))
                        {
                            var dragConnector = DragElement as NodeConnector;
                            if (dragConnector.Node == destinationConnector.Node ||
                                DragElement.ElementType == element.ElementType)
                            {
                                element = null;
                                break;
                            }
                        }

                        draggingOverElement = destinationConnector.Node;
                        break;
                    }
                }
            }

            if (HoverElement != element)
            {
                HoverElement = element;
                needRedraw = true;
            }

            if (internalDragOverElement != draggingOverElement)
            {
                if (internalDragOverElement != null)
                {
                    SetFlag(internalDragOverElement, RenderState.DraggedOver, false);
                    var node = GetElementNode(internalDragOverElement);
                    if (node != null)
                        GraphRenderer.PerformLayout(this.CreateGraphics(), node);
                    needRedraw = true;
                }

                internalDragOverElement = draggingOverElement;

                if (internalDragOverElement != null)
                {
                    SetFlag(internalDragOverElement, RenderState.DraggedOver, true);
                    var node = GetElementNode(internalDragOverElement);
                    if (node != null)
                        GraphRenderer.PerformLayout(this.CreateGraphics(), node);
                    needRedraw = true;
                }
            }

            if (destinationConnector != null)
            {
                if (!destinationConnector.bounds.IsEmpty)
                {
                    var pre_points = new PointF[] {
                        new PointF((destinationConnector.bounds.Left + destinationConnector.bounds.Right) / 2,
                                    (destinationConnector.bounds.Top  + destinationConnector.bounds.Bottom) / 2) };
                    transformation.TransformPoints(pre_points);
                    snappedLocation = pre_points[0];
                }
            }

            if (needRedraw)
                this.Refresh();
        }
Beispiel #31
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            if (currentButtons != MouseButtons.None)
                return;

            currentButtons |= e.Button;
            selectedNodes.Clear();
            unselectedNodes.Clear();
            dragging	= true;
            abortDrag	= false;
            mouseMoved	= false;
            SnappedLocation = LastLocation = e.Location;

            var points = new PointF[] { e.Location };
            inverse_transformation.TransformPoints(points);
            var transformed_location = points[0];

            OriginalLocation = transformed_location;

            if (e.Button == MouseButtons.Left)
            {
                var element = FindElementAt(transformed_location);
                if (element != null)
                {
                    var selection = FocusElement as NodeSelection;
                    var element_node = element as Node;
                    if (element_node != null)
                    {
                        switch (ModifierKeys)
                        {
                            case Keys.None:
                            {
                                if (selection != null &&
                                    selection.Nodes.Contains(element_node))
                                {
                                    element = selection;
                                }
                                break;
                            }
                            case Keys.Shift:
                            {
                                if (selection != null)
                                {
                                    if (!selection.Nodes.Contains(element_node))
                                    {
                                        var nodes = selection.Nodes.ToList();
                                        nodes.Add(element_node);
                                        element = new NodeSelection(nodes);
                                    }
                                } else
                                {
                                    var focus_node = FocusElement as Node;
                                    if (focus_node != null)
                                        element = new NodeSelection(new Node[] { focus_node, element_node });
                                }
                                break;
                            }
                            case Keys.Control:
                            {
                                if (selection != null)
                                {
                                    if (selection.Nodes.Contains(element_node))
                                    {
                                        var nodes = selection.Nodes.ToList();
                                        nodes.Remove(element_node);
                                        element = new NodeSelection(nodes);
                                    } else
                                    {
                                        var nodes = selection.Nodes.ToList();
                                        nodes.Add(element_node);
                                        element = new NodeSelection(nodes);
                                    }
                                } else
                                {
                                    var focus_node = FocusElement as Node;
                                    if (focus_node != null)
                                    {
                                        if (focus_node == element_node)
                                            element = null;
                                        else
                                            element = new NodeSelection(new Node[] { focus_node, element_node });
                                    }
                                }
                                break;
                            }
                            case Keys.Alt:
                            {
                                if (selection != null)
                                {
                                    if (selection.Nodes.Contains(element_node))
                                    {
                                        var nodes = selection.Nodes.ToList();
                                        nodes.Remove(element_node);
                                        element = new NodeSelection(nodes);
                                    }
                                } else
                                {
                                    var focus_node = FocusElement as Node;
                                    if (focus_node != null)
                                        element = null;
                                }
                                break;
                            }
                        }
                    }

                    var item = element as NodeItem;
                    if (item != null)
                    {
                        if (!item.OnStartDrag(transformed_location, out OriginalLocation))
                        {
                            element = item.Node;
                            OriginalLocation = transformed_location;
                        }
                    } else
                    {
                        var connection = element as NodeConnection;
                        if (connection != null)
                            OriginalLocation = connection.To.Center;
                    }

                    // Should compatible connectors be highlighted?
                    if (HighlightCompatible && null != CompatibilityStrategy)
                    {
                        var connectorFrom = element as NodeConnector;
                        if (connectorFrom == null)
                        {
                            var connection = element as NodeConnection;
                            if (connection != null)
                                connectorFrom = connection.From;
                        }
                        if (connectorFrom != null)
                        {
                            if (element.ElementType == ElementType.InputConnector)
                            {
                                // Iterate over all nodes
                                foreach (Node graphNode in graphNodes)
                                {
                                    // Check compatibility of node connectors
                                    foreach (NodeConnector connectorTo in graphNode.outputConnectors)
                                    {
                                        if (CompatibilityStrategy.CanConnect(connectorFrom, connectorTo))
                                        {
                                            SetFlag(connectorTo, RenderState.Compatible, true);
                                        } else
                                            SetFlag(connectorTo, RenderState.Incompatible, true);
                                    }
                                }
                            } else
                            {
                                // Iterate over all nodes
                                foreach (Node graphNode in graphNodes)
                                {
                                    // Check compatibility of node connectors
                                    foreach (NodeConnector connectorTo in graphNode.inputConnectors)
                                    {
                                        if (CompatibilityStrategy.CanConnect(connectorFrom, connectorTo))
                                        {
                                            SetFlag(connectorTo, RenderState.Compatible, true);
                                        } else
                                            SetFlag(connectorTo, RenderState.Incompatible, true);
                                    }
                                }
                            }
                        }
                    }

                    FocusElement =
                        DragElement = element;
                    BringElementToFront(element);
                    this.Refresh();
                    command = CommandMode.Edit;
                } else
                    command = CommandMode.MarqueSelection;
            } else
            {
                DragElement = null;
                command = CommandMode.TranslateView;
            }

            points = new PointF[] { OriginalLocation };
            transformation.TransformPoints(points);
            OriginalMouseLocation = this.PointToScreen(new Point((int)points[0].X, (int)points[0].Y));
        }
Beispiel #32
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            if (currentButtons != MouseButtons.None)
                return;

            currentButtons |= e.Button;
            selectedNodes.Clear();
            unselectedNodes.Clear();
            dragging	= true;
            abortDrag	= false;
            mouseMoved	= false;
            snappedLocation = lastLocation = e.Location;

            var points = new PointF[] { e.Location };
            inverse_transformation.TransformPoints(points);
            var transformed_location = points[0];

            originalLocation = transformed_location;

            if (e.Button == MouseButtons.Left)
            {
                var element = FindElementAt(transformed_location);
                if (element != null)
                {
                    var selection = FocusElement as NodeSelection;
                    var element_node = element as Node;
                    if (element_node != null)
                    {
                        switch (ModifierKeys)
                        {
                            case Keys.None:
                            {
                                if (selection != null &&
                                    selection.Nodes.Contains(element_node))
                                {
                                    element = selection;
                                }
                                break;
                            }
                            case Keys.Shift:
                            {
                                if (selection != null)
                                {
                                    if (!selection.Nodes.Contains(element_node))
                                    {
                                        var nodes = selection.Nodes.ToList();
                                        nodes.Add(element_node);
                                        element = new NodeSelection(nodes);
                                    }
                                } else
                                {
                                    var focus_node = FocusElement as Node;
                                    if (focus_node != null)
                                        element = new NodeSelection(new Node[] { focus_node, element_node });
                                }
                                break;
                            }
                            case Keys.Control:
                            {
                                if (selection != null)
                                {
                                    if (selection.Nodes.Contains(element_node))
                                    {
                                        var nodes = selection.Nodes.ToList();
                                        nodes.Remove(element_node);
                                        element = new NodeSelection(nodes);
                                    } else
                                    {
                                        var nodes = selection.Nodes.ToList();
                                        nodes.Add(element_node);
                                        element = new NodeSelection(nodes);
                                    }
                                } else
                                {
                                    var focus_node = FocusElement as Node;
                                    if (focus_node != null)
                                    {
                                        if (focus_node == element_node)
                                            element = null;
                                        else
                                            element = new NodeSelection(new Node[] { focus_node, element_node });
                                    }
                                }
                                break;
                            }
                            case Keys.Alt:
                            {
                                if (selection != null)
                                {
                                    if (selection.Nodes.Contains(element_node))
                                    {
                                        var nodes = selection.Nodes.ToList();
                                        nodes.Remove(element_node);
                                        element = new NodeSelection(nodes);
                                    }
                                } else
                                {
                                    var focus_node = FocusElement as Node;
                                    if (focus_node != null)
                                        element = null;
                                }
                                break;
                            }
                        }
                    }

                    var item = element as NodeItem;
                    if (item != null)
                    {
                        if (!item.OnStartDrag(transformed_location, out originalLocation))
                        {
                            element = item.Node;
                            originalLocation = transformed_location;
                        }
                    } else
                    {
                        var connection = element as NodeConnection;
                        if (connection != null)
                            originalLocation = connection.To.Center;
                    }
                    FocusElement =
                        DragElement = element;
                    BringElementToFront(element);
                    this.Refresh();
                    command = CommandMode.Edit;
                } else
                    command = CommandMode.MarqueSelection;
            } else
            {
                DragElement = null;
                command = CommandMode.TranslateView;
            }

            points = new PointF[] { originalLocation };
            transformation.TransformPoints(points);
            originalMouseLocation = this.PointToScreen(new Point((int)points[0].X, (int)points[0].Y));
        }
Beispiel #33
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            currentButtons &= ~e.Button;

            bool needRedraw = false;
            if (!dragging)
                return;
            try
            {
                Point currentLocation;
                PointF transformed_location;
                if (abortDrag)
                {
                    transformed_location = originalLocation;

                    var points = new PointF[] { originalLocation };
                    transformation.TransformPoints(points);
                    currentLocation = new Point((int)points[0].X, (int)points[0].Y);
                } else
                {
                    currentLocation = e.Location;

                    var points = new PointF[] { currentLocation };
                    inverse_transformation.TransformPoints(points);
                    transformed_location = points[0];
                }

                switch (command)
                {
                    case CommandMode.MarqueSelection:
                        if (abortDrag)
                        {
                            foreach (var node in selectedNodes)
                                SetFlag(node, RenderState.Focus, false, false);

                            foreach (var node in unselectedNodes)
                                SetFlag(node, RenderState.Focus, true, false);

                        } else
                        {
                            NodeSelection selection = null;
                            if (graphNodes.Count > 0)
                            {
                                // select all focused nodes
                                var result = (from node in graphNodes
                                              where (node.state & RenderState.Focus) == RenderState.Focus
                                              select node).ToList();
                                if (result.Count > 0)
                                    selection = new NodeSelection(result);
                            }
                            FocusElement = selection;
                        }
                        this.Invalidate();
                        return;
                    case CommandMode.ScaleView:
                        return;
                    case CommandMode.TranslateView:
                        return;

                    default:
                    case CommandMode.Edit:
                        break;
                }
                if (DragElement != null)
                {
                    switch (DragElement.ElementType)
                    {
                        case ElementType.InputConnector:
                        {
                            var inputConnector	= (NodeConnector)DragElement;
                            var outputConnector = HoverElement as NodeOutputConnector;
                            if (outputConnector != null &&
                                outputConnector.Node != inputConnector.Node)
                                FocusElement = Connect(outputConnector, inputConnector);
                            needRedraw = true;
                            return;
                        }
                        case ElementType.OutputConnector:
                        {
                            var outputConnector = (NodeConnector)DragElement;
                            var inputConnector	= HoverElement as NodeInputConnector;
                            if (inputConnector != null &&
                                inputConnector.Node != outputConnector.Node)
                                FocusElement = Connect(outputConnector, inputConnector);
                            needRedraw = true;
                            return;
                        }
                        default:
                        case ElementType.NodeSelection:
                        case ElementType.Connection:
                        case ElementType.NodeItem:
                        case ElementType.Node:
                        {
                            needRedraw = true;
                            return;
                        }
                    }
                }
                if (DragElement != null ||
                    FocusElement != null)
                {
                    FocusElement = null;
                    needRedraw = true;
                }
            }
            finally
            {
                if (DragElement != null)
                {
                    var nodeItem = DragElement as NodeItem;
                    if (nodeItem != null)
                        nodeItem.OnEndDrag();
                    DragElement = null;
                    needRedraw = true;
                }

                dragging = false;
                command = CommandMode.Edit;
                selectedNodes.Clear();
                unselectedNodes.Clear();

                if (needRedraw)
                    this.Refresh();

                base.OnMouseUp(e);
            }
        }
Beispiel #34
0
        public void SetUp()
        {
            _caret = MockObjectFactory.CreateCaret();
            _caret.SetupProperty(x => x.IsHidden);
            _view = new Mock<IWpfTextView>(MockBehavior.Strict);
            _view.SetupGet(x => x.Caret).Returns(_caret.Object);

            _bufferData = MockObjectFactory.CreateVimBuffer(view:_view.Object);
            _processor = new Mock<ICommandProcessor>(MockBehavior.Strict);
            _modeRaw = new CommandMode(_bufferData.Object, _processor.Object);
            _mode = _modeRaw;
        }
Beispiel #35
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="tableName"></param>
 /// <param name="editType"></param>
 /// <param name="columns"></param>
 public MySqlCommandStruct(string tableName, CommandMode editType, string columns = "")
     : base(tableName, editType, columns)
 {
 }
Beispiel #36
0
 public void EnterNormalMode()
 {
     _commandMode = CommandMode.Normal;
 }
Beispiel #37
0
 public static IDictionary Get(this IDictionary src, CommandMode mode)
 {
     if (src != null ? src.Contains(mode) : false)
         return src[mode] as IDictionary;
     return null;
 }
 public OrientationCommand(Orientation orientation, CommandMode mode)
 {
     Orientation = orientation;
     Mode = mode;
 }
    //アイテムをどうするかの選択
    public void SelectItem(AllyStatus allyStatus, Item item)
    {
        //アイテムの種類に応じて出来る項目を変更する
        if (item.GetItemType() == Item.Type.ArmorAll ||
            item.GetItemType() == Item.Type.ArmorUnityChan ||
            item.GetItemType() == Item.Type.ArmorYuji ||
            item.GetItemType() == Item.Type.WeaponAll ||
            item.GetItemType() == Item.Type.WeaponUnityChan ||
            item.GetItemType() == Item.Type.WeaponYuji)
        {
            var itemMenuButtonIns = Instantiate <GameObject>(useItemPanelButtonPrefab, useItemPanel.transform);
            if (item == allyStatus.GetEquipWeapon() || item == allyStatus.GetEquipArmor())
            {
                itemMenuButtonIns.GetComponentInChildren <Text>().text = "装備を外す";
                itemMenuButtonIns.GetComponent <Button>().onClick.AddListener(() => RemoveEquip(allyStatus, item));
            }
            else
            {
                itemMenuButtonIns.GetComponentInChildren <Text>().text = "装備する";
                itemMenuButtonIns.GetComponent <Button>().onClick.AddListener(() => Equip(allyStatus, item));
            }

            itemMenuButtonIns = Instantiate <GameObject>(useItemPanelButtonPrefab, useItemPanel.transform);
            itemMenuButtonIns.GetComponentInChildren <Text>().text = "渡す";
            itemMenuButtonIns.GetComponent <Button>().onClick.AddListener(() => PassItem(allyStatus, item));

            itemMenuButtonIns = Instantiate <GameObject>(useItemPanelButtonPrefab, useItemPanel.transform);
            itemMenuButtonIns.GetComponentInChildren <Text>().text = "捨てる";
            itemMenuButtonIns.GetComponent <Button>().onClick.AddListener(() => ThrowAwayItem(allyStatus, item));
        }
        else if (item.GetItemType() == Item.Type.NumbnessRecovery ||
                 item.GetItemType() == Item.Type.PoisonRecovery ||
                 item.GetItemType() == Item.Type.HPRecovery ||
                 item.GetItemType() == Item.Type.MPRecovery
                 )
        {
            var itemMenuButtonIns = Instantiate <GameObject>(useItemPanelButtonPrefab, useItemPanel.transform);
            itemMenuButtonIns.GetComponentInChildren <Text>().text = "使う";
            itemMenuButtonIns.GetComponent <Button>().onClick.AddListener(() => UseItem(allyStatus, item));

            itemMenuButtonIns = Instantiate <GameObject>(useItemPanelButtonPrefab, useItemPanel.transform);
            itemMenuButtonIns.GetComponentInChildren <Text>().text = "渡す";
            itemMenuButtonIns.GetComponent <Button>().onClick.AddListener(() => PassItem(allyStatus, item));

            itemMenuButtonIns = Instantiate <GameObject>(useItemPanelButtonPrefab, useItemPanel.transform);
            itemMenuButtonIns.GetComponentInChildren <Text>().text = "捨てる";
            itemMenuButtonIns.GetComponent <Button>().onClick.AddListener(() => ThrowAwayItem(allyStatus, item));
        }
        else if (item.GetItemType() == Item.Type.Valuables)
        {
            informationTitleText.text = item.GetKanjiName();
            informationText.text      = item.GetInformation();
        }

        if (item.GetItemType() != Item.Type.Valuables)
        {
            useItemPanel.SetActive(true);
            itemPanelCanvasGroup.interactable = false;
            currentCommand = CommandMode.UseItemPanel;
            //ItemPanelで最後にどれを選択していたか?
            selectedGameObjectStack.Push(EventSystem.current.currentSelectedGameObject);

            useItemPanel.transform.SetAsLastSibling();
            EventSystem.current.SetSelectedGameObject(useItemPanel.transform.GetChild(0).gameObject);
            useItemPanelCanvasGroup.interactable = true;
            Input.ResetInputAxes();
        }
    }
Beispiel #40
0
	    protected AssociationsSerializer fSerialize; // Serialization format
        
        public metadataBase() : base()
        {
            fMode = CommandMode.kCreate;
            fMeshes = new MObjectArray();
        }
    public void UseItemToCharacter(AllyStatus fromChara, AllyStatus toChara, Item item)
    {
        useItemInformationPanel.SetActive(true);
        useItemSelectCharacterPanelCanvasGroup.interactable = false;
        useItemSelectCharacterPanel.SetActive(false);

        if (item.GetItemType() == Item.Type.HPRecovery)
        {
            if (toChara.GetHp() == toChara.GetMaxHp())
            {
                useItemInformationPanel.GetComponentInChildren <Text>().text = toChara.GetCharacterName() + "は元気です。";
            }
            else
            {
                toChara.SetHp(toChara.GetHp() + item.GetAmount());
                //アイテムを使用した旨を表示
                useItemInformationPanel.GetComponentInChildren <Text>().text = fromChara.GetCharacterName() + "は" + item.GetKanjiName() + "を" + toChara.GetCharacterName() + "に使用しました。\n" +
                                                                               toChara.GetCharacterName() + "は" + item.GetAmount() + "回復しました。";
                //持っているアイテム数を減らす
                fromChara.SetItemNum(item, fromChara.GetItemNum(item) - 1);
            }
        }
        else if (item.GetItemType() == Item.Type.MPRecovery)
        {
            if (toChara.GetMp() == toChara.GetMaxMp())
            {
                useItemInformationPanel.GetComponentInChildren <Text>().text = toChara.GetCharacterName() + "のMPは最大です。";
            }
            else
            {
                toChara.SetMp(toChara.GetMp() + item.GetAmount());
                //アイテムを使用した旨を表示
                useItemInformationPanel.GetComponentInChildren <Text>().text = fromChara.GetCharacterName() + "は" + item.GetKanjiName() + "を" + toChara.GetCharacterName() + "に使用しました。\n" +
                                                                               toChara.GetCharacterName() + "はMPを" + item.GetAmount() + "回復しました。";
                //持っているアイテム数を減らす
                fromChara.SetItemNum(item, fromChara.GetItemNum(item) - 1);
            }
        }
        else if (item.GetItemType() == Item.Type.PoisonRecovery)
        {
            if (!toChara.IsPoisonState())
            {
                useItemInformationPanel.GetComponentInChildren <Text>().text = toChara.GetCharacterName() + "は毒状態ではありません。";
            }
            else
            {
                useItemInformationPanel.GetComponentInChildren <Text>().text = toChara.GetCharacterName() + "は毒から回復しました。";
                toChara.SetPoisonState(false);
                //持っているアイテム数を減らす
                fromChara.SetItemNum(item, fromChara.GetItemNum(item) - 1);
            }
        }
        else if (item.GetItemType() == Item.Type.NumbnessRecovery)
        {
            if (!toChara.IsPoisonState())
            {
                useItemInformationPanel.GetComponentInChildren <Text>().text = toChara.GetCharacterName() + "は痺れ状態ではありません。";
            }
            else
            {
                useItemInformationPanel.GetComponentInChildren <Text>().text = toChara.GetCharacterName() + "は痺れから回復しました。";
                toChara.SetNumbness(false);
                //持っているアイテム数を減らす
                fromChara.SetItemNum(item, fromChara.GetItemNum(item) - 1);
            }
        }

        //アイテムを使用したらアイテムを使用する相手のUseItemSelectCharacterPanelの子要素のボタンを全削除
        for (int i = useItemSelectCharacterPanel.transform.childCount - 1; i >= 0; i--)
        {
            Destroy(useItemSelectCharacterPanel.transform.GetChild(i).gameObject);
        }
        //itemPanleButtonListから該当するアイテムを探し数を更新する
        var itemButton = itemPanelButtonList.Find(obj => obj.transform.Find("ItemName").GetComponent <Text>().text == item.GetKanjiName());

        itemButton.transform.Find("Num").GetComponent <Text>().text = fromChara.GetItemNum(item).ToString();

        //アイテム数が0だったらボタンとキャラクターステータスからアイテムを削除
        if (fromChara.GetItemNum(item) == 0)
        {
            //アイテムが0になったら一気にItemPanelに戻す為、UseItemPanel内とUseItemSelectCharacterPanel内でのオブジェクト登録を削除
            selectedGameObjectStack.Pop();
            selectedGameObjectStack.Pop();
            //itemPanelButtonListからアイテムパネルボタンを削除
            itemPanelButtonList.Remove(itemButton);
            //アイテムパネルボタン自身の削除
            Destroy(itemButton);
            //アイテムを渡したキャラクター自身のItemDictionaryからそのアイテムを削除
            fromChara.GetItemDictionary().Remove(item);
            //ItemPanelに戻る為、UseItemPanel内に作ったボタンを全削除
            for (int i = useItemPanel.transform.childCount - 1; i >= 0; i--)
            {
                Destroy(useItemPanel.transform.GetChild(i).gameObject);
            }
            //アイテム数が0になったのでCommandMode.NoItemPassedに変更
            currentCommand = CommandMode.NoItemPassed;
            useItemInformationPanel.transform.SetAsLastSibling();
            Input.ResetInputAxes();
        }
        else
        {
            //アイテム数が残っている場合はUseItemPanelでアイテムをどうするかの選択に戻る
            currentCommand = CommandMode.UseItemSelectCharacterPanelToUseItemPanel;
            useItemInformationPanel.transform.SetAsLastSibling();
            Input.ResetInputAxes();
        }
    }
 public void ActivateMode(CommandMode mode, long ActiveTimeMs) {
     CurrentMode = mode;
     ActiveUntil = Environment.TickCount + ActiveTimeMs;
 }
    //装備する
    public void Equip(AllyStatus allyStatus, Item item)
    {
        //キャラクター毎に装備出来る武器や鎧かどうかを調べ装備を切り替える
        if (allyStatus.GetCharacterName() == "プレイヤー")
        {
            if (item.GetItemType() == Item.Type.ArmorAll ||
                item.GetItemType() == Item.Type.ArmorUnityChan)
            {
                var equipArmorButton = itemPanelButtonList.Find(itemPanelButton => itemPanelButton.transform.Find("ItemName").GetComponent <Text>().text == item.GetKanjiName());
                equipArmorButton.transform.Find("Equip").GetComponent <Text>().text = "E";
                //装備している鎧があればItemPanelでEquipのEを外す
                if (allyStatus.GetEquipArmor() != null)
                {
                    equipArmorButton = itemPanelButtonList.Find(itemPanelButton => itemPanelButton.transform.Find("ItemName").GetComponent <Text>().text == allyStatus.GetEquipArmor().GetKanjiName());
                    equipArmorButton.transform.Find("Equip").GetComponent <Text>().text = "";
                }
                allyStatus.SetEquipArmor(item);
                useItemInformationPanel.GetComponentInChildren <Text>().text = allyStatus.GetCharacterName() + "は" + item.GetKanjiName() + "を装備しました。";
            }
            else if (item.GetItemType() == Item.Type.WeaponAll ||
                     item.GetItemType() == Item.Type.WeaponUnityChan)
            {
                var equipWeaponButton = itemPanelButtonList.Find(itemPanelButton => itemPanelButton.transform.Find("ItemName").GetComponent <Text>().text == item.GetKanjiName());
                equipWeaponButton.transform.Find("Equip").GetComponent <Text>().text = "E";
                //装備している武器があればItemPanelでEquipのEを外す
                if (allyStatus.GetEquipWeapon() != null)
                {
                    equipWeaponButton = itemPanelButtonList.Find(itemPanelButton => itemPanelButton.transform.Find("ItemName").GetComponent <Text>().text == allyStatus.GetEquipWeapon().GetKanjiName());
                    equipWeaponButton.transform.Find("Equip").GetComponent <Text>().text = "";
                }
                allyStatus.SetEquipWeapon(item);
                useItemInformationPanel.GetComponentInChildren <Text>().text = allyStatus.GetCharacterName() + "は" + item.GetKanjiName() + "を装備しました。";
            }
            else
            {
                useItemInformationPanel.GetComponentInChildren <Text>().text = allyStatus.GetCharacterName() + "は" + item.GetKanjiName() + "を装備出来ません。";
            }
        }
        else if (allyStatus.GetCharacterName() == "カイト")
        {
            if (item.GetItemType() == Item.Type.ArmorAll ||
                item.GetItemType() == Item.Type.ArmorYuji)
            {
                var equipArmorButton = itemPanelButtonList.Find(itemPanelButton => itemPanelButton.transform.Find("ItemName").GetComponent <Text>().text == item.GetKanjiName());
                equipArmorButton.transform.Find("Equip").GetComponent <Text>().text = "E";

                if (allyStatus.GetEquipArmor() != null)
                {
                    equipArmorButton = itemPanelButtonList.Find(itemPanelButton => itemPanelButton.transform.Find("ItemName").GetComponent <Text>().text == allyStatus.GetEquipArmor().GetKanjiName());
                    equipArmorButton.transform.Find("Equip").GetComponent <Text>().text = "";
                }
                allyStatus.SetEquipArmor(item);
                useItemInformationPanel.GetComponentInChildren <Text>().text = allyStatus.GetCharacterName() + "は" + item.GetKanjiName() + "を装備しました。";
            }
            else if (item.GetItemType() == Item.Type.WeaponAll ||
                     item.GetItemType() == Item.Type.WeaponYuji)
            {
                var equipWeaponButton = itemPanelButtonList.Find(itemPanelButton => itemPanelButton.transform.Find("ItemName").GetComponent <Text>().text == item.GetKanjiName());
                equipWeaponButton.transform.Find("Equip").GetComponent <Text>().text = "E";

                if (allyStatus.GetEquipWeapon() != null)
                {
                    equipWeaponButton = itemPanelButtonList.Find(itemPanelButton => itemPanelButton.transform.Find("ItemName").GetComponent <Text>().text == allyStatus.GetEquipWeapon().GetKanjiName());
                    equipWeaponButton.transform.Find("Equip").GetComponent <Text>().text = "";
                }
                allyStatus.SetEquipWeapon(item);
                useItemInformationPanel.GetComponentInChildren <Text>().text = allyStatus.GetCharacterName() + "は" + item.GetKanjiName() + "を装備しました。";
            }
            else
            {
                useItemInformationPanel.GetComponentInChildren <Text>().text = allyStatus.GetCharacterName() + "は" + item.GetKanjiName() + "を装備出来ません。";
            }
        }
        //装備を切り替えたらItemPanelに戻る
        useItemPanelCanvasGroup.interactable = false;
        useItemPanel.SetActive(false);
        itemPanelCanvasGroup.interactable = true;
        //ItemPanelに戻るのでUseItemPanelの子要素に作ったボタンを全削除
        for (int i = useItemPanel.transform.childCount - 1; i >= 0; i--)
        {
            Destroy(useItemPanel.transform.GetChild(i).gameObject);
        }

        useItemInformationPanel.transform.SetAsLastSibling();
        useItemInformationPanel.SetActive(true);

        currentCommand = CommandMode.UseItemPanelToItemPanel;

        Input.ResetInputAxes();
    }
 public bool IsModeActive(CommandMode mode) => mode == CurrentMode && ActiveUntil > Environment.TickCount;
Beispiel #45
0
        protected override object GetGeneObject(CommandType cmdType, string cmdText, object cmdParms, CommandMode cmdMode)
        {
            //判断IsConnected,直接退出
            if (!this.IsConnected)
            {
                this.Connect();
            }
            if (!this.IsConnected)
            {
                this.ReturnValue = null; return(null);
            }

            OdbcCommand oCmd = new OdbcCommand();

            oCmd.Connection  = this.GetConnection();
            oCmd.CommandType = cmdType;
            oCmd.CommandText = cmdText;
            if (cmdParms != null)
            {
                foreach (OdbcParameter parm in (OdbcParameter[])cmdParms)
                {
                    oCmd.Parameters.Add(parm);
                }
            }
            object r = null;

            try
            {
                r = FillIn(oCmd, cmdMode);
                #if DEBUG
                this.DealMsg(cmdText, false);
                #endif
            }
            catch (OdbcException e)
            {
                this.ExecError = e;
                string errorMsg = "Odbc.GetGeneObject:[" + cmdText + "](" + e.Message + "),Faild,错误信息已经复制到剪切版!";
                this.DealMsg(errorMsg, true);
            }
            oCmd             = null;
            this.ReturnValue = r;
            return(r);
        }
Beispiel #46
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            if (currentButtons != MouseButtons.None)
                return;

            currentButtons |= e.Button;
            dragging = true;
            abortDrag = false;
            mouseMoved = false;
            snappedLocation = lastLocation = e.Location;

            var points = new PointF[] { e.Location };
            inverse_transformation.TransformPoints(points);
            var transformed_location = points[0];

            originalLocation = transformed_location;

            if (e.Button == MouseButtons.Left)
            {
                var vertex = FindVertexAt(transformed_location);
                if (vertex != null)
                {
                    var element_node = vertex;

                    FocusElement = DragElement = vertex;
                    BringElementToFront(vertex);
                    this.Refresh();
                }
            }
            else
            {
                DragElement = null;
                command = CommandMode.TranslateView;
            }

            points = new PointF[] { originalLocation };
            transformation.TransformPoints(points);
            originalMouseLocation = this.PointToScreen(new Point((int)points[0].X, (int)points[0].Y));
        }
Beispiel #47
0
 public Store.Common.MessageInfo ManageItemMaster(Store.Category.BusinessObject.Category objCategory, CommandMode cmdMode)
 {
     try
     {
         return(odlCategory.ManageCategory(objCategory, cmdMode));
     }
     catch (Exception ex)
     {
         Store.Common.Utility.ExceptionLog.Exceptionlogs(ex.Message, Store.Common.Utility.ExceptionLog.LineNumber(ex), typeof(Category).FullName, 1);
         return(null);
     }
 }
Beispiel #48
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            if (DragElement == null)
            {
                if (currentButtons == MouseButtons.Left)
                    command = CommandMode.TranslateView;
                else if (currentButtons == MouseButtons.Right)
                    command = CommandMode.ScaleView;
                else command = CommandMode.None;//
            }

            Point currentLocation;
            PointF transformed_location;
            if (abortDrag)
            {
                transformed_location = originalLocation;

                var points = new PointF[] { originalLocation };
                transformation.TransformPoints(points);
                currentLocation = new Point((int)points[0].X, (int)points[0].Y);
            }
            else
            {
                currentLocation = e.Location;

                var points = new PointF[] { currentLocation };
                inverse_transformation.TransformPoints(points);
                transformed_location = points[0];
            }

            var deltaX = (lastLocation.X - currentLocation.X) / zoom;
            var deltaY = (lastLocation.Y - currentLocation.Y) / zoom;

            bool needRedraw = false;
            switch (command)
            {
                case CommandMode.ScaleView:
                    if (!mouseMoved)
                    {
                        if ((Math.Abs(deltaY) > 1))
                            mouseMoved = true;
                    }

                    if (mouseMoved &&
                        (Math.Abs(deltaY) > 0))
                    {
                        zoom *= (float)Math.Pow(2, deltaY / 100.0f);
                        Cursor.Position = this.PointToScreen(lastLocation);
                        snappedLocation = //lastLocation =
                            currentLocation;
                        this.Refresh();
                    }
                    return;
                case CommandMode.TranslateView:
                    {
                        if (!mouseMoved)
                        {
                            if ((Math.Abs(deltaX) > 1) ||
                                (Math.Abs(deltaY) > 1))
                                mouseMoved = true;
                        }

                        if (mouseMoved &&
                            (Math.Abs(deltaX) > 0) ||
                            (Math.Abs(deltaY) > 0))
                        {
                            translation.X -= deltaX * zoom;
                            translation.Y -= deltaY * zoom;
                            snappedLocation = lastLocation = currentLocation;
                            this.Refresh();
                        }
                        return;
                    }
            }

            if (dragging)
            {
                if (!mouseMoved)
                {
                    if ((Math.Abs(deltaX) > 1) ||
                        (Math.Abs(deltaY) > 1))
                        mouseMoved = true;
                }

                if (mouseMoved &&
                    (Math.Abs(deltaX) > 0) ||
                    (Math.Abs(deltaY) > 0))
                {
                    mouseMoved = true;
                    if (DragElement != null)
                    {
                        BringElementToFront(DragElement);

                        if (new Vertex().GetType().Equals(DragElement.GetType()))
                        {
                            var vertex = DragElement as Vertex;
                            PointF location = (PointF)vertex.GetAlgorithmObj(_KH_PANE_LOCATION);
                            RectangleF bounds = (RectangleF)vertex.GetAlgorithmObj(_KH_PANE_BOUNDS);
                            vertex.SetAlgorithmObj(_KH_PANE_LOCATION
                                , new PointF((int)Math.Round(location.X - deltaX),
                                           (int)Math.Round(location.Y - deltaY))
                            );
                            vertex.SetAlgorithmObj(_KH_PANE_BOUNDS
                                , new RectangleF(
                                    (int)Math.Round(bounds.X- deltaX),
                                    (int)Math.Round(bounds.Y - deltaY),
                                    (int)Math.Round(bounds.Width),
                                    (int)Math.Round(bounds.Height)
                                    )
                            );
                            snappedLocation = lastLocation = currentLocation;
                            this.Refresh();
                            return;
                        }
                    }
                }
            }

            //NodeConnector destinationConnector = null;
            //IElement draggingOverElement = null;

            IEdge elementEdge = FindEdgeAt(transformed_location);

            if (elementEdge != null)
            {
                if (HoverElement != elementEdge)
                {
                    HoverElement = elementEdge;
                    needRedraw = true;
                }
            }
            else
            {
                IVertex elementVertex = FindVertexAt(transformed_location);

                if (HoverElement != elementVertex)
                {
                    HoverElement = elementVertex;
                    needRedraw = true;
                }
            }

            if (needRedraw)
                this.Refresh();
        }
Beispiel #49
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="tableName"></param>
 /// <param name="editType"></param>
 /// <param name="columns"></param>
 public CommandStruct(string tableName, CommandMode editType, string columns = "")
     : this(tableName, editType, new CommandFilter(), columns)
 {
 }
Beispiel #50
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            currentButtons &= ~e.Button;

            bool needRedraw = false;
            if (!dragging)
                return;

            try
            {
                Point currentLocation;
                PointF transformed_location;
                if (abortDrag)
                {
                    transformed_location = originalLocation;

                    var points = new PointF[] { originalLocation };
                    transformation.TransformPoints(points);
                    currentLocation = new Point((int)points[0].X, (int)points[0].Y);
                }
                else
                {
                    currentLocation = e.Location;

                    var points = new PointF[] { currentLocation };
                    inverse_transformation.TransformPoints(points);
                    transformed_location = points[0];
                }

                if (DragElement != null)
                {
                    DragElement = null;
                    needRedraw = true;
                }

            }
            finally
            {
                if (DragElement != null)
                {
                    DragElement = null;
                    needRedraw = true;
                }

                dragging = false;
                command = CommandMode.None;

                if (needRedraw)
                    this.Refresh();

                base.OnMouseUp(e);
            }
        }
 /// <summary>
 /// 创建CommandStruct对象
 /// </summary>
 /// <param name="tableName">表名</param>
 /// <param name="editType">命令操作类型</param>
 /// <param name="columns">查询列</param>
 /// <returns></returns>
 public abstract CommandStruct CreateCommandStruct(string tableName, CommandMode editType, string columns = "");
Beispiel #52
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="tableName"></param>
 /// <param name="editType"></param>
 public MySqlCommandStruct(string tableName, CommandMode editType)
     : base(tableName, editType)
 {
 }
Beispiel #53
0
        public Store.Common.MessageInfo ManagePurchaseOrder(Store.PurchaseOrderItem.BusinessObject.PurchaseOrderItemList objPurchaseOrderItemlist, CommandMode cmdMode)
        {
            string        SQL   = "";
            ParameterList param = null;

            Store.Common.MessageInfo objMessageInfo = null;

            try
            {
                SQL = "USP_ManagePurchaseOrderItem";
                foreach (Store.PurchaseOrderItem.BusinessObject.PurchaseOrderItem objPurchaseOrderItem in objPurchaseOrderItemlist)
                {
                    param = new ParameterList();
                    DataTableReader dr;
                    param.Add(new SQLParameter("@PurchaseOrderID", objPurchaseOrderItem.PurchaseOrderID));
                    param.Add(new SQLParameter("@PurchaseOrderItemID", objPurchaseOrderItem.PurchaseOrderItemID));
                    param.Add(new SQLParameter("@ItemID", objPurchaseOrderItem.ItemID));
                    param.Add(new SQLParameter("@ItemPrefix", objPurchaseOrderItem.ItemPrefix));
                    param.Add(new SQLParameter("@Description", objPurchaseOrderItem.Description));
                    param.Add(new SQLParameter("@ItemUnit", objPurchaseOrderItem.ItemUnit));
                    param.Add(new SQLParameter("@ItemPrice", objPurchaseOrderItem.ItemPrice));
                    param.Add(new SQLParameter("@TotalPrice", objPurchaseOrderItem.TotalPrice));
                    param.Add(new SQLParameter("@Discount", objPurchaseOrderItem.Discount));
                    param.Add(new SQLParameter("@DiscountPre", objPurchaseOrderItem.DiscountPre));
                    param.Add(new SQLParameter("@UserId", objPurchaseOrderItem.CreatedBy));
                    param.Add(new SQLParameter("@ReferenceID", objPurchaseOrderItem.ReferenceID));
                    param.Add(new SQLParameter("@IsActive", objPurchaseOrderItem.IsActive));
                    param.Add(new SQLParameter("@CMDMode", cmdMode));
                    dr = ExecuteQuery.ExecuteReader(SQL, param);

                    if (dr.Read())
                    {
                        objMessageInfo              = new Store.Common.MessageInfo();
                        objMessageInfo.ErrorCode    = Convert.ToInt32(dr["ErrorCode"]);
                        objMessageInfo.ErrorMessage = Convert.ToString(dr["ErrorMessage"]);
                        objMessageInfo.TranID       = Convert.ToInt32(dr["TranID"]);
                        objMessageInfo.TranCode     = Convert.ToString(dr["TranCode"]);
                        objMessageInfo.TranMessage  = Convert.ToString(dr["TranMessage"]);
                    }
                }
            }
            catch (Exception ex)
            {
                Store.Common.Utility.ExceptionLog.Exceptionlogs(ex.Message, Store.Common.Utility.ExceptionLog.LineNumber(ex), typeof(PurchaseOrderItem).FullName, 1);
            }
            return(objMessageInfo);
        }
Beispiel #54
0
 public static IEnumerable<IVIMAction> GetVIMCommand(CommandMode mode, Key keyStroke, KeyStates keyStates)
 {
     yield return _commands.Get(mode).Get(keyStates).Get(keyStroke);
 }
Beispiel #55
0
        public void SetUp()
        {
            _factory = new MockRepository(MockBehavior.Strict);
            _selection = _factory.Create<ITextSelection>();
            _selection.Setup(x => x.IsEmpty).Returns(true);
            _buffer = EditorUtil.CreateBuffer();
            _caret = MockObjectFactory.CreateCaret(factory: _factory);
            _caret.SetupProperty(x => x.IsHidden);
            _textView = MockObjectFactory.CreateTextView(
                buffer: _buffer,
                caret: _caret.Object,
                selection: _selection.Object,
                factory: _factory);

            _bufferData = MockObjectFactory.CreateVimBuffer(view: _textView.Object, factory: _factory);
            _processor = _factory.Create<ICommandProcessor>();
            _modeRaw = new CommandMode(_bufferData.Object, _processor.Object);
            _mode = _modeRaw;
        }
Beispiel #56
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="tableName"></param>
        /// <param name="editType"></param>
        /// <param name="columns"></param>
        public CommandStruct(string tableName, CommandMode editType, string columns = "")
            : this(tableName, editType, new CommandFilter(), columns)
        {

        }
Beispiel #57
0
 /// <summary>
 /// Runs the specified command on the database.
 /// </summary>
 /// <typeparam name="TReturn">Type to be returned.</typeparam>
 /// <param name="command">Command to run</param>
 /// <param name="param">Optional param object (can be anonymous)</param>
 public void RunCommand(string command, object param, CommandMode mode)
 {
     this.RunCommand <dynamic>(command: command, param: param, mode: mode);
 }
Beispiel #58
0
 public void EnterInsertMode()
 {
     _commandMode = CommandMode.Insert;
 }