// todo. 일단 직렬화에 대해 공부해야 함.
    public override void OnInspectorGUI()
    {
        showScriptField();

        직렬화된요소표시("텍스트필드");          /// EventScript클래스의 변수 '텍스트필드'를 표시
        직렬화된요소표시("isDrawable");

        EventScript es = (EventScript)serializedObject.targetObject;

        if (es.isDrawable == true)
        {
            직렬화된요소표시("isHighPriorityCard");

            if (es.isHighPriorityCard == false)
            {
                직렬화된요소표시("cardPropability");
            }
            직렬화된요소표시("maxDraws");
        }

        직렬화된요소표시("conditions");
        직렬화된요소표시("Results");
        직렬화된요소표시("changeValueOnCardDespawn");
        직렬화된요소표시("OnCardSpawn");
        직렬화된요소표시("OnCardDespawn");

        직렬화된요소표시("OnSwipeLeft");
        직렬화된요소표시("OnSwipeRight");

        GUILayout.Space(15);

        //base.OnInspectorGUI ();
    }
		public static void AddScript(EventScript myScript)
		{
			if (myScript == null)
				return;

			EventScriptQueue.Enqueue(myScript);
		}
        public void GetNextCommand_Empty()
        {
            var script = new EventScript();
            var target = new ScriptCommandSource(script, CommandParser.GetDefault());

            target.GetNextCommand().Should().Be(null);
        }
Esempio n. 4
0
        private void ShowInfomation(ListBox lb, int hoverindex)
        {
            if (hoverindex < 0 || hoverindex > lb.Items.Count)
            {//範囲外
                this.Infomation.Text = "";
                return;
            }
            if (this.LastHoverIndex == hoverindex)
            {//最後に表示していた行と同じ
                return;
            }
            this.LastHoverIndex  = hoverindex;
            this.Infomation.Text = "";

            string listtext = lb.Items[hoverindex].ToString();

            foreach (EventScript.Script script in Program.EventScript.Scripts)
            {
                if (EventScript.makeCommandComboText(script, true) == listtext)
                {
                    if (script.PopupHint == "")
                    {
                        break;
                    }

                    this.Infomation.Text = listtext + "\r\n" + script.PopupHint;

                    return;
                }
            }
        }
    /// <summary>
    /// 상속받은 OnInspectorGUI()를 오버라이드해서 구현해준다. 이 메서드를 구현함으로 인해  사용자 정의 GUI를 추가 할수 있다.
    /// </summary>
    public override void OnInspectorGUI()
    {
        /// todo. 작업중.
        showScriptField();

        직렬화된요소표시("텍스트필드");    /// 작업중. EventScript클래스의 변수 '텍스트필드'를 직렬화해서 가져와야 한다.
        직렬화된요소표시("그리기가능여부");  /// 작업중.

        EventScript es = (EventScript)serializedObject.targetObject;

        if (es.그리기가능여부 == true)
        {
            직렬화된요소표시("isHighPriorityCard");

            if (es.isHighPriorityCard == false)
            {
                직렬화된요소표시("cardPropability");
            }
            직렬화된요소표시("그리기최대값");                      /// 'EventScript'클래스의 변수인 '그리기최대값'을 직렬화된요소로 표시한다.
        }

        직렬화된요소표시("컨디션들");     // 'EventScript'클래스의 변수인 '컨디션들'을 직렬화된요소로 표시한다.
        직렬화된요소표시("결과");       // 'EventScript'클래스의 변수인 '결과'를 직렬화된요소로 표시한다.
        직렬화된요소표시("자동차스폰변경값"); // 'EventScript'클래스의 변수인 '자동차출발값변경값'을 직렬화된요소로 표시한다.
        직렬화된요소표시("카드스폰");     // 'EventScript'클래스의 변수인 '카드스폰'을 직렬화된요소로 표시한다.
        직렬화된요소표시("카드디스폰");    // 'EventScript'클래스의 변수인 '카드디스폰'을 직렬화된요소로 표시한다.

        직렬화된요소표시("OnSwipeLeft");
        직렬화된요소표시("OnSwipeRight");

        GUILayout.Space(15);

        //base.OnInspectorGUI ();
    }
Esempio n. 6
0
        private void CategoryListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            string category = GetSelectedCategory();
            bool   filtered = category.Length > 0;

            string lang         = OptionForm.lang();
            bool   isJP         = (lang == "ja");
            string filterString = U.CleanupFindString(this.Filter.Text, isJP);

            this.ListBox.BeginUpdate();
            this.ListBox.Items.Clear();
            this.ScriptCahce.Clear();
            foreach (EventScript.Script script in Program.AIScript.Scripts)
            {
                if (filtered == true)
                {
                    if (script.Category.IndexOf(category) < 0)
                    {
                        continue;
                    }
                }
                string name = EventScript.makeCommandComboText(script, true);
                if (filterString.Length > 0)
                {
                    if (!U.StrStrEx(name + " " + script.PopupHint, filterString, isJP))
                    {//フィルターで消す.
                        continue;
                    }
                }

                this.ListBox.Items.Add(name);
                this.ScriptCahce.Add(script);
            }
            this.ListBox.EndUpdate();
        }
Esempio n. 7
0
        private void ScriptChangeButton_Click(object sender, EventArgs e)
        {
            ProcsScriptCategorySelectForm form = (ProcsScriptCategorySelectForm)InputFormRef.JumpFormLow <ProcsScriptCategorySelectForm>();
            DialogResult dr = form.ShowDialog();

            if (dr != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }

            EventScript.Script script = form.Script;

            //選択した命令を代入
            byte[] selectedByteData = script.Data;
            this.ASMTextBox.Text     = U.convertByteToStringDump(selectedByteData);
            this.ScriptCodeName.Text = EventScript.makeCommandComboText(script, false);

            //イベントを逆アセンブルして確定する.
            OneLineDisassembler();
            //値1を自動選択
            if (ParamSrc1.Visible)
            {
                ParamSrc1.Focus();
            }
        }
Esempio n. 8
0
 // Update is called once per frame
 void Update()
 {
     if (simulationManager.initialSeekAlgorithmDone)
     {
         //If the victim is NOT saved
         if (!isSaved)
         {
             timer += Time.deltaTime;
             if (timer > simulationStep)
             {
                 timer = 0;
                 currentStep++;
             }
             if (currentStep >= survivalTime && isAlive)
             {
                 isAlive = false;
                 //TODO: ADD TO HEAP FOR VICTIM DEATH
                 EventScript es = new EventScript(currentStep, " VictimDeath ", this.name, " - ", " - ");
                 simulationManager.addEvent(es);
                 EventScriptVictim esv = new EventScriptVictim(this.name, (int)position.x, (int)position.y, survivalTime, false, 0, " ", 0);
                 simulationManager.addEventVictim(esv);
                 //Destroy(this.gameObject);
                 GameObject X = Instantiate(victimDeadX, this.transform.position, Quaternion.identity);
                 X.transform.parent = this.transform;
             }
         }
         else if (madeSavedEvent == false)
         {
             madeSavedEvent = true;
             EventScriptVictim es = new EventScriptVictim(this.name, (int)position.x, (int)position.y, survivalTime, true, timeRescued, ambulanceToPickUpVictim.name, currentStep);
             simulationManager.addEventVictim(es);
             //EventScript es = new EventScriptVictim(name, LocationInfo, survivalTime, ifSaved, timeRescued, ambulanceThatUnloaded, "unloaded at", time);
         }
     }
 }
Esempio n. 9
0
        void FireChanegCommandByDirectMode()
        {
            ProcsScriptCategorySelectForm form = (ProcsScriptCategorySelectForm)InputFormRef.JumpFormLow <ProcsScriptCategorySelectForm>();
            DialogResult dr = form.ShowDialog();

            if (dr != System.Windows.Forms.DialogResult.OK)
            {
                //直接編集モードだったら、キャンセルされた場合は、コントロールパネルも消す.
                HideFloatingControlpanel();
                return;
            }

            EventScript.Script script = form.Script;

            //選択した命令を代入
            byte[] selectedByteData = script.Data;
            this.ASMTextBox.Text     = U.convertByteToStringDump(selectedByteData);
            this.ScriptCodeName.Text = EventScript.makeCommandComboText(script, false);

            //イベントを逆アセンブルして確定する.
            OneLineDisassembler();
            //値1を自動選択
            if (ParamSrc1.Visible)
            {
                ParamSrc1.Focus();
            }
        }
Esempio n. 10
0
        public override void Execute(EventExecutionContext context, CommandExecutionHandle handle)
        {
            var dialog = context.GetModule <DialogModule>();

            if (dialog == default)
            {
                context.RaiseError(new ScriptExecutionException("DialogModuleが登録されていません。"));
                return;
            }

            if (dialog.CurrentProvider != null)
            {
                var providerName = dialog.CurrentProvider.ProviderName;

                dialog.Close(() =>
                {
                    var script                = new EventScript();
                    script.CommandList        = commandList;
                    script.WaitForAllCommands = true;
                    context.InsertInherit(script, () => { dialog.Open(providerName, handle.Complete); });
                });
            }
            else
            {
                var script = new EventScript();
                script.CommandList        = commandList;
                script.WaitForAllCommands = true;
                context.InsertInherit(script, handle.Complete);
            }
        }
Esempio n. 11
0
 public EventEngine(MapleCharacter starter, string script, int recreateMap = -1, bool skipSpawn = false)
 {
     Starter   = starter;
     ChannelId = Starter.Client.Channel;
     if (!(DataBuffer.EventScripts.TryGetValue(script, out EventType) && EventType != null))
     {
         return;
     }
     EventInstance = ScriptActivator.CreateScriptInstance(EventType, script, starter) as EventScript;
     if (EventInstance == null)
     {
         string error = string.Format("Error loading {0} {1}", "EventScript", script);
         ServerConsole.Error(error);
         FileLogging.Log("Event scripts", error);
         return;
     }
     RecreatedMap                     = recreateMap != -1;
     EventInstance.OnFinish          += new Action(FinishEvent);
     EventInstance.OnSpawnMobs       += new Action <int, int, int, int>(SpawnMobs);
     EventInstance.OnRandomSpawnMobs += new Action <int, int, Point, Point>(RandomSpawnMobs);
     if (RecreatedMap)
     {
         EventMap = new MapleEvent(recreateMap, DataBuffer.GetMapById(recreateMap), skipSpawn);
         EventId  = Program.RegisterEvent(EventMap);
         if (Starter != null)
         {
             AddCharacter(Starter);
         }
     }
 }
Esempio n. 12
0
        void ShowFloatingControlpanel()
        {
            int index = this.Script.SelectedIndex;

            if (index < 0 || index >= this.ProcsScript.Count)
            {//一件もない
                this.ASMTextBox.Text     = "";
                this.ScriptCodeName.Text = "";
                this.CommentTextBox.Text = "";
                this.AddressTextBox.Text = "";
                OneLineDisassembler();
            }
            else
            {
                EventScript.OneCode code = this.ProcsScript[index];

                //コードを書く
                this.ASMTextBox.Text     = U.convertByteToStringDump(code.ByteData);
                this.ScriptCodeName.Text = EventScript.makeCommandComboText(code.Script, false);
                this.CommentTextBox.Text = code.Comment;
                this.AddressTextBox.Text = U.ToHexString(EventScript.ConvertSelectedToAddr((uint)this.Address.Value, index, this.ProcsScript));

                //Eventをデコードして、引数等を求めなおす.
                OneLineDisassembler();
            }
            //変更ボタンが光っていたら、それをやめさせる.
            InputFormRef.WriteButtonToYellow(this.UpdateButton, false);
            InputFormRef.WriteButtonToYellow(this.NewButton, false);

            ControlPanel.Show();
        }
        void RunUndoRollback(UndoData u)
        {
            this.ProcsScript = EventScript.CloneEventList(u.EventAsm);

            //リストの更新.
            this.Script.DummyAlloc(this.ProcsScript.Count, this.Script.SelectedIndex);
        }
Esempio n. 14
0
    //sorting the all-cards pool for available cards, which meet the conditions
    void sortForPossibleCards()
    {
        EventScript es = null;

        availableCards.Clear();
        highPriorityCards.Clear();
        bool conditionOk = true;

        for (int i = 0; i < allCards.Length; i++)
        {
            //test, if condition for group is met
            if (valueManager.instance.AreConditinsForResultMet(allCards[i].subStackCondition) == true)
            {
                //if the group condition is true, test the cards from the group
                for (int j = 0; j < allCards [i].groupCards.Length; j++)
                {
                    es          = allCards [i].groupCards [j].GetComponent <EventScript> ();
                    conditionOk = true;

                    //block the card from drawing, if max number of draws is reached
                    if (cardDrawCount.cnt [i].drawCnt [j] >= es.maxDraws)
                    {
                        conditionOk = false;
                    }

                    //block the card from drawing, if is blocked because it was drawed recently
                    if (cardBlockCount.cnt[i].drawCnt[j] > 0)
                    {
                        conditionOk = false;
                    }

                    foreach (EventScript.condition c in es.conditions)
                    {
                        if (valueManager.instance.getConditionMet(c) == true)
                        {
                            //condition is ok.
                        }
                        else
                        {
                            conditionOk = false;
                            break;
                        }
                    }

                    if (conditionOk == true && es.isDrawable == true)
                    {
                        if (es.isHighPriorityCard == true)
                        {
                            highPriorityCards.Add(allCards [i].groupCards [j]);
                        }
                        else
                        {
                            availableCards.Add(allCards [i].groupCards [j]);
                        }
                    }
                }
            }
        }
    }
Esempio n. 15
0
        void RunUndoRollback(UndoData u)
        {
            this.ProcsScript = EventScript.CloneEventList(u.EventAsm);

            //最後に自下げ処理実行.
            EventScriptUtil.JisageReorder(this.ProcsScript);
            //リストの更新.
            this.Script.DummyAlloc(this.ProcsScript.Count, this.Script.SelectedIndex);
        }
Esempio n. 16
0
 public void addValues()
 {
     Debug.LogWarning("(" + gameObject.name + "):'addValues()' is obsolete. Please use 'ChangeValues()' of the script 'changeValue.cs' instead. 'addValues()' will be removed in future releases.");
     foreach (EventScript.resultModifier rm in valuesToChange)
     {
         //For each other case use the standard handling of the result.
         EventScript.executeValueChange(rm);
     }
 }
Esempio n. 17
0
    //private Update updateFn;
    void Start()
    {
        theEvents = new EventScript();
        theStates = new StateScript();
        Scene scene = SceneManager.GetActiveScene();

        theEvents = GetComponent <EventScript> ();
        //Debug.Log ("Active Scene is: " + scene.name);
    }
Esempio n. 18
0
    // Start is called before the first frame update
    void Start()
    {
        move        = GetComponent <PlayerMovement>();
        health      = GetComponent <PlayerHealth>();
        eventScript = eventTextBox.GetComponent <EventScript>();

        weaponRef    = GameObject.FindWithTag("Weapon");
        weaponScript = weaponRef.GetComponent <Weapon>();
    }
Esempio n. 19
0
        private void OneLineDisassembler()
        {
            int i;

            if (this.ASMTextBox.Text.Length < 8)
            {//命令は最低でも8バイトでないとダメ.
                for (i = this.ASMTextBox.Text.Length; i < 8; i++)
                {
                    this.ASMTextBox.Text += "0";
                }
            }

            //文字列からバイト列に
            byte[] selectedByteData = U.convertStringDumpToByte(this.ASMTextBox.Text);
            if (selectedByteData.Length < 4)
            {
                return;
            }
            string hint = this.ScriptCodeName.Text;

            //バイト列をイベント命令としてDisassembler.
            EventScript.OneCode code = Program.ProcsScript.DisAseemble(selectedByteData, 0, hint);

            //命令を選択.
            this.ScriptCodeName.Text = EventScript.makeCommandComboText(code.Script, false);

            //引数
            int n = 0;

            for (i = 0; i < 2; i++, n++)
            {
                if (n >= code.Script.Args.Length)
                {
                    break;
                }
                EventScript.Arg arg = code.Script.Args[n];
                uint            v   = EventScript.GetArgValue(code, arg);

                if (EventScript.IsFixedArg(arg))
                {//固定長になっているところは入力できないようにする.
                    i--;
                    continue;
                }

                EventScriptForm.SetOneScriptEditSetTables(ScriptEditSetTables[i], arg, v);
            }

            for (; i < 2; i++)
            {
                //使わないパラメータはあっかりーんする
                EventScriptForm.HideOneScriptEditSetTables(ScriptEditSetTables[i]);
            }
            int y = ShowFloatingControlpanelInner(code, this.Script.SelectedIndex);

            ControlPanel.Location = new Point(ControlPanel.Location.X, y);
        }
Esempio n. 20
0
    private void Awake()
    {
        if (instance != null)
        {
            Msg.instance.Print(Msg.ErrorType.Error, 25, "More than one EventScript in scene !", true, false);
            return;
        }

        instance = this;
    }
    public EventScript pop()
    {
        EventScript data = eventArray[1];

        eventArray[1] = eventArray[load--];
        percolateDown(1);

        eventArray.RemoveAt(load + 1);
        return(data);
    }
Esempio n. 22
0
 void Start()
 {
     feasibleStates = new List <string> ()
     {
         "on-hold", "on-play"
     };
     lastState     = feasibleStates [0];
     myEventScript = GetComponent <EventScript> ();
     myUpdateFn    = FindObjectOfType <UpdateFn> ();
 }
Esempio n. 23
0
    //cyclic test, if ad is available and enable/disable the 'watchAdButton' and generate 'onAdAvailable' event
    IEnumerator testForAdvertisement()
    {
        yield return(null);

        onAdNotAvailable.Invoke();

        yield return(new WaitForSecondsRealtime(0.5f));

        while (true)
        {
            if (adsSaveEnabled == true)
            {
#if UNITY_ADS
                if ((Advertisement.IsReady(placement) && rewardedAd == true) || (Advertisement.IsReady() && rewardedAd == false))
                {
                    if (watchAdButton != null)
                    {
                        watchAdButton.interactable = true;
                    }

                    if (advertisementAvailable == false)
                    {
                        advertisementAvailable = true;
                        onAdAvailable.Invoke();
#if KINGS_GAME_ASSET_ADS
                        EventScript.executeValueChange(valueIfAvailable);
#endif
                    }
                    //Debug.Log ("Ad is ready");
                }
                else
                {
                    if (watchAdButton != null)
                    {
                        watchAdButton.interactable = false;
                    }
                    //generate 'ad not available' event on first start or if it was available bevore
                    if (advertisementAvailable == true || advertisementTested == false)
                    {
                        advertisementAvailable = false;
                        advertisementTested    = true;
                        onAdNotAvailable.Invoke();
#if KINGS_GAME_ASSET_ADS
                        EventScript.executeValueChange(valueIfNotAvailable);
#endif
                    }
                    //	Debug.Log ("Ad is NOT ready");
                }
#endif
            }

            yield return(new WaitForSecondsRealtime(1f));
        }
    }
Esempio n. 24
0
        void PushUndo()
        {
            if (this.UndoPosstion < this.UndoBuffer.Count)
            {//常に先頭に追加したいので、リスト中に戻っている場合は、それ以降を消す.
                this.UndoBuffer.RemoveRange(this.UndoPosstion, this.UndoBuffer.Count - this.UndoPosstion);
            }
            UndoData p = new UndoData();

            p.EventAsm = EventScript.CloneEventList(this.ProcsScript);
            this.UndoBuffer.Add(p);
            this.UndoPosstion = this.UndoBuffer.Count;
        }
Esempio n. 25
0
        private UniTask PlayNestedCommands(EventExecutionContext context)
        {
            var cs = new UniTaskCompletionSource();

            var script = new EventScript();

            script.CommandList        = nestedCommands;
            script.WaitForAllCommands = false;
            context.InsertInherit(script, () => { cs.TrySetResult(); });

            return(cs.Task);
        }
        public void GetNextCommand_Test()
        {
            var script = new EventScript(
                "test1",
                "test2"
                );
            var target = new ScriptCommandSource(script, CommandParser.GetDefault());

            target.GetNextCommand().Object.Verb.Should().Be("test1");
            target.GetNextCommand().Object.Verb.Should().Be("test2");
            target.GetNextCommand().Should().Be(null);
        }
Esempio n. 27
0
 public static bool ToEventScriptDTO(EventScript input, EventScriptDTO output)
 {
     if (input == null)
     {
         return(false);
     }
     output.EventScriptId = input.EventScriptId;
     output.Script        = input.Script;
     output.DateStart     = input.DateStart;
     output.DateEnd       = input.DateEnd;
     return(true);
 }
Esempio n. 28
0
    // Start is called before the first frame update
    void Start()
    {
        currentExp      = 0;
        expBar.maxValue = levelUp;
        expBar.value    = currentExp;
        eventScript     = eventDisplay.GetComponent <EventScript>();

        statLogic = statDisplay.GetComponent <StatLogic>();

        statLogic.UpdateDamage(bulletDamage);
        statLogic.UpdateBulletCount(bulletCount);
    }
    void Start()
    {
        player      = GameObject.Find("Player1");
        ps          = player.GetComponent <PlayerScript>();
        ps.curSpace = "Moscow";

        terrname = GameObject.Find("Canvas").transform.Find("Panel").transform.Find("Name").GetComponent <Text>();
        terrcost = GameObject.Find("Canvas").transform.Find("Panel").transform.Find("Cost").GetComponent <Text>();
        terrgain = GameObject.Find("Canvas").transform.Find("Panel").transform.Find("Gain").GetComponent <Text>();
        buybutt  = GameObject.Find("Canvas").transform.Find("Panel").transform.Find("Button").GetComponent <BuyScritpt>();
        events   = GameObject.Find("Canvas").transform.Find("EventPanel").transform.Find("CardText").GetComponent <EventScript>();
    }
Esempio n. 30
0
    //public Inventory_ChangeItem.itemModifier[] itemChanges;


    public void ChangeValues()
    {
        foreach (EventScript.resultModifier rm in valuesToChange)
        {
            EventScript.executeValueChange(rm);
        }

        /*foreach(Inventory_ChangeItem.itemModifier im in itemChanges)
         * {
         *  Inventory_ChangeItem.executeItemChange(im);
         * }*/
    }
    //sorting the all-cards pool for available cards, which meet the conditions
    void sortForPossibleCards()
    {
        EventScript es = null;

        availableCards.Clear();
        highPriorityCards.Clear();
        bool conditionOk = true;

        for (int i = 0; i < allCards.Length; i++)
        {
            //test, if condition for group is met
            if (ValueManager.나자신.AreConditinsForResultMet(allCards[i].subStackCondition) == true)
            {
                //if the group condition is true, test the cards from the group
                for (int j = 0; j < allCards [i].groupCards.Length; j++)
                {
                    es          = allCards [i].groupCards [j].GetComponent <EventScript> ();
                    conditionOk = true;

                    if (cardDrawCount.cnt [i].drawCnt [j] >= es.maxDraws)
                    {
                        conditionOk = false;
                    }

                    foreach (EventScript.콘디션 c in es.conditions)
                    {
                        if (ValueManager.나자신.GetConditionMet(c) == true)
                        {
                            //condition is ok.
                        }
                        else
                        {
                            conditionOk = false;
                            break;
                        }
                    }

                    if (conditionOk == true && es.isDrawable == true)
                    {
                        if (es.isHighPriorityCard == true)
                        {
                            highPriorityCards.Add(allCards [i].groupCards [j]);
                        }
                        else
                        {
                            availableCards.Add(allCards [i].groupCards [j]);
                        }
                    }
                }
            }
        }
    }
Esempio n. 32
0
    // set the object to not be destroyed on new scene loading
    void Awake()
    {
        //Debug.Log("created new grid");
        //if we don't have an [_instance] set yet
        if (!_instance)
            _instance = this;
        //otherwise, if we do, kill this thing
        else
        {
            //Debug.Log("Error message should be right before this");
            Destroy(this.gameObject);
        }

        DontDestroyOnLoad(this.gameObject);

        //DontDestroyOnLoad(transform.gameObject);
    }