public CharacterAction(int _myIndex, int _targetIndex, ACTION_TYPE _actionType, FORMATION_TYPE _formationType)
 {
     myIndex       = _myIndex;
     targetIndex   = _targetIndex;
     actionType    = _actionType;
     formationType = _formationType;
 }
Example #2
0
    public override void execute()
    {
        List <MahjongAction> actionList = new List <MahjongAction>();

        for (int i = 0; i < 4; ++i)
        {
            Character   player        = mCharacterManager.getCharacter(mActionPlayer.mValue[i]);
            Character   droppedPlayer = mCharacterManager.getCharacter(mDroppedPlayer.mValue[i]);
            ACTION_TYPE type          = (ACTION_TYPE)mAction.mValue[i];
            if (type != ACTION_TYPE.AT_MAX)
            {
                MAHJONG        mah    = (MAHJONG)mMahjong.mValue[i];
                List <HU_TYPE> huList = null;
                if (type == ACTION_TYPE.AT_HU)
                {
                    huList = new List <HU_TYPE>();
                    for (int j = 0; j < GameDefine.MAX_HU_COUNT; ++j)
                    {
                        if (mHuList.mValue[i] == 0)
                        {
                            break;
                        }
                        huList.Add((HU_TYPE)mHuList.mValue[i]);
                    }
                }
                actionList.Add(new MahjongAction(type, player, droppedPlayer, mah, huList));
            }
        }
        CommandCharacterAskAction cmd = mCommandSystem.newCmd <CommandCharacterAskAction>();

        cmd.mActionList = actionList;
        mCommandSystem.pushCommand(cmd, mCharacterManager.getMyself());
    }
 public void HandleAction(ACTION_TYPE type)
 {
     if (type == ACTION_TYPE.PARENT_TRIGGER_ACTIVATED) {
         myLerp = 0.0f;
         myStateEnabled = true;
     }
 }
Example #4
0
 //驚き
 private void SetSurpriseAnimation()
 {
     _reactionEffect.ReactionGenerate(ReactionEffectGenerator.REACTION_TYPE.REACTION_TYPE_SURPRISE);
     _clone = (GameObject)Instantiate(_player_animes[(int)ANIM_TYPE.ANIM_TYPE_SURPRISE], gameObject.transform.position, Quaternion.identity);
     _clone.transform.parent = gameObject.transform;
     _action_type            = ACTION_TYPE.ACTION_TYPE_STOP;
 }
Example #5
0
    protected void showPengGang(int index, ACTION_TYPE type, MAHJONG mah)
    {
        int count = 0;

        if (type == ACTION_TYPE.AT_PENG)
        {
            count = 3;
        }
        else if (type == ACTION_TYPE.AT_GANG)
        {
            count = 4;
        }
        else
        {
            return;
        }
        LT.ACTIVE_WINDOW(mPengGangSingleRoot[index]);
        int    maxCount          = mMahjongWindows[index].Count;
        string mahjongSpriteName = mMahjongPreName + GameDefine.MAHJONG_NAME[(int)mah];

        for (int i = 0; i < maxCount; ++i)
        {
            LT.ACTIVE_WINDOW(mMahjongWindows[index][i], i < count);
            if (i < count)
            {
                mMahjongWindows[index][i].setSpriteName(mahjongSpriteName);
            }
        }
    }
Example #6
0
        public Action(string name, string type, string actor, string doact, string require, string run, string done, string src, string dst, long time)
        {
            Name = name;
            if (type == "RUN")
            {
                Type = ACTION_TYPE.RUN;
            }
            else if (type == "MOVE")
            {
                Type = ACTION_TYPE.MOVE;
            }
            else if (type == "CARRY")
            {
                Type = ACTION_TYPE.CARRY;
            }
            else
            {
                Type = ACTION_TYPE.SETREG;
            }

            ActorName   = actor;
            DoActCode   = doact;
            RequireCode = require;
            RunCode     = run;
            DoneCode    = done;
            Src         = src;
            Dst         = dst;
            Timecost    = time;
            ToRun       = true;
        }
Example #7
0
 public MahjongAction(ACTION_TYPE type, Character actionPlayer, Character droppedPlayer, MAHJONG mahjong, List <HU_TYPE> huList = null)
 {
     mType          = type;
     mActionPlayer  = actionPlayer;
     mDroppedPlayer = droppedPlayer;
     mMah           = mahjong;
     mHuList        = huList;
 }
Example #8
0
 public void HandleAction(ACTION_TYPE type)
 {
     if (type == ACTION_TYPE.PUZZLE_SOLVED) {
         for (int idx = 0; idx < transform.GetChildCount(); idx++) {
             transform.GetChild (idx).SendMessage (CommonAction.HANDLE_ACTION_METHOD_NAME, ACTION_TYPE.PUZZLE_SOLVED, SendMessageOptions.DontRequireReceiver);
         }
     }
 }
 public void HandleAction(ACTION_TYPE type)
 {
     if (type == ACTION_TYPE.PARENT_TRIGGER_ACTIVATED) {
         myLerp = 0.0f;
         myStateEnabled = true;
         //mySpriteRenderer.EnableJumpStateForEva ();
         //WaterMonitor.EnableEndState();
     }
 }
        public void CalculateDuration()
        {
            int duration = 0;

            if (TrackedPlaybackInfo == null)
            {
                return;
            }

            List <KeyValuePair <DateTime, ACTION_TYPE> > events = null;

            // if the last event is not a stop event then add one to allow duration calculation to work
            if (event_tracking.Count > 0 && event_tracking[event_tracking.Count - 1].Value != ACTION_TYPE.STOP)
            {
                events = new List <KeyValuePair <DateTime, ACTION_TYPE> >();
                foreach (KeyValuePair <DateTime, ACTION_TYPE> e in event_tracking)
                {
                    events.Add(e);
                }
                KeyValuePair <DateTime, ACTION_TYPE> stop_event = new KeyValuePair <DateTime, ACTION_TYPE>(DateTime.Now, ACTION_TYPE.STOP);
                events.Add(stop_event);
            }
            else
            {
                events = event_tracking;
            }

            _logger.Debug("PlaybackTracker : Finding Duration : EventCount : " + events.Count);

            KeyValuePair <DateTime, ACTION_TYPE> prev_event = new KeyValuePair <DateTime, ACTION_TYPE>(DateTime.Now, ACTION_TYPE.NONE);

            foreach (KeyValuePair <DateTime, ACTION_TYPE> e in events)
            {
                if (prev_event.Value != ACTION_TYPE.NONE)
                {
                    ACTION_TYPE action01 = prev_event.Value;
                    ACTION_TYPE action02 = e.Value;
                    // count up the activity that is considered PLAYING i.e. the client was actually playing and not paused
                    if ((action01 == ACTION_TYPE.START || action01 == ACTION_TYPE.UNPAUSE) && (action02 == ACTION_TYPE.STOP || action02 == ACTION_TYPE.PAUSE))
                    {
                        TimeSpan diff         = e.Key.Subtract(prev_event.Key);
                        double   diff_seconds = diff.TotalSeconds;
                        duration += (int)diff_seconds;
                        _logger.Debug("PlaybackTracker : Event : Time Diff : " + (int)diff_seconds + " total : " + duration);
                    }
                }

                _logger.Debug("PlaybackTracker : Event : " + e.Key.ToString() + " " + e.Value);
                prev_event = e;
            }

            _logger.Debug("PlaybackTracker : Calculated total play duration : " + duration);
            TrackedPlaybackInfo.PlaybackDuration = duration;
        }
Example #11
0
        public Action(string action)
        {
            string typeString = action.Substring(0, action.IndexOf(' ')).ToUpper();

            ACTION_TYPE type;

            Enum.TryParse(typeString, out type);

            this.type = type;

            text = action.Substring(action.IndexOf(' ') + 1);
        }
Example #12
0
    /**
    * @fn   public void HandleAction(ACTION_TYPE type)
    * @brief    When the trigger action for the parent of the door object sends a message with PARENT_TRIGGER_ACTIVATED then the door will turn on gravity and slam shut...
    * @author   Eagan
    * @date 2/3/2012
    * @param    type    The type.
    */
    public void HandleAction(ACTION_TYPE type)
    {
        if (type == ACTION_TYPE.PARENT_TRIGGER_ACTIVATED) {
            myDoorLerp = 0.0f;
            myDoorState = DoorState.DoorClosing;
            audio.Play ();
        } else if (type == ACTION_TYPE.PUZZLE_SOLVED) {
            if(myPuzzlesSolved < myNumberOfPuzzles)
            {
                lerpsToDo++;
            }

        }
    }
Example #13
0
    ///ACTION_TYPE별 애니메이션 정의
    void SetActionType(ACTION_TYPE type)
    {
        atype = type;
        switch (atype)
        {
        case ACTION_TYPE.ch_idle:
        {
            SkeletonAnimation.state.SetAnimation(0, "idle", true);
        }
        break;

        case ACTION_TYPE.ch_leftmove:
        {
            SkeletonAnimation.skeleton.FlipX = true;         //좌우반전
            SkeletonAnimation.state.SetAnimation(0, "run", true);
        }
        break;

        case ACTION_TYPE.ch_rightmove:
        {
            SkeletonAnimation.skeleton.FlipX = false;         //좌우반전
            SkeletonAnimation.state.SetAnimation(0, "run", true);
        }
        break;

        case ACTION_TYPE.ch_jump:
        {
            SkeletonAnimation.state.SetAnimation(0, "jump", false);
            Myrigidbody.AddForce(0.0f, force, 0.0f);
        }
        break;

        case ACTION_TYPE.ch_attack:
        {
            SkeletonAnimation.state.SetAnimation(0, "attack", false);
        }
        break;

        case ACTION_TYPE.ch_damage:
        {
            //피격 애니메이션 넣기
            SkeletonAnimation.state.SetAnimation(0, "idle", true);         //임시로 기본애니메이션 넣음
            Myrigidbody.AddForce(force, force, 0.0f);
        }
        break;

        default: break;
        }
    }
Example #14
0
        /// <summary>
        /// Make an action for this CinematicAnimation at the given time.
        /// </summary>
        /// <param name="type">What kind of action is this?</param>
        /// <param name="target">The TransformComponent to act on</param>
        /// <param name="endArgument">Primary argument for the action, like Vector3 for SET_POSITION</param>
        /// <param name="startTime">What time to do this action?</param>
        /// <param name="startArgument">Where should this action start from? null if use whatever we are currently at</param>
        /// <param name="endTime">When to end this action?</param>
        public void AddAction(ACTION_TYPE type, TransformComponent target, object endArgument, float startTime, object startArgument = null, float endTime = 0f)
        {
            CinematicAction ca = new CinematicAction()
            {
                Type                  = type,
                target                = target,
                argument0             = startArgument,
                argument1             = endArgument,
                startTime             = startTime,
                endTime               = endTime,
                relativeStartArgument = startArgument == null
            };

            AllActions.Add(ca);
            if (CurrentTime <= startTime)
            {
                RemainingActions.Add(ca);
            }
        }
Example #15
0
        public RegistersForm(PCIE_Device dev, ACTION_TYPE regType)
        {
            InitializeComponent();

            m_device  = dev;
            m_regType = regType;

            switch (regType)
            {
            case ACTION_TYPE.CFG:
            {
                this.Text        = "Read/Write Configuration Space by Registers";
                lblRegs.Visible  = true;
                lblRegs.Text     = "Choose a Cfg Register";
                cmboRegs.Visible = true;
                WDC_REG[] regs = dev.Regs.gPCIE_CfgRegs;
                for (int i = 0; i < regs.GetLength(0); ++i)
                {
                    cmboRegs.Items.AddRange(new object[] { regs[i].sName +
                                                           " size: " + regs[i].dwSize.ToString("X") +
                                                           " - " + regs[i].sDesc });
                }
                break;
            }

            case ACTION_TYPE.RT:
            {
                this.Text        = "Read/Write RunTime Registers";
                lblRegs.Visible  = true;
                lblRegs.Text     = "Choose a RunTime Register";
                cmboRegs.Visible = true;
                WDC_REG[] regs = m_device.Regs.gPCIE_RT_Regs;
                for (int i = 0; i < regs.GetLength(0); ++i)
                {
                    cmboRegs.Items.AddRange(new object[] { regs[i].sName +
                                                           " size: " + regs[i].dwSize.ToString("X") +
                                                           " - " + regs[i].sDesc });
                }
                break;
            }
            }
        }
Example #16
0
        public FormRestaurantAddEdit(FormRestaurant frm, ACTION_TYPE action)
        {
            InitializeComponent();
            this.frmParent = frm;
            this.action    = action;
            switch (this.action)
            {
            case ACTION_TYPE.VIEW:
                this.DisableEdit();
                break;

            case ACTION_TYPE.CREATE:
                this.SetActionButton("Thêm");
                break;

            case ACTION_TYPE.EDIT:
                this.SetActionButton("Sửa");
                break;
            }
        }
    //------------------------------------------------------------------------------------------------------
    protected void onActionClicked(GameObject obj)
    {
        ACTION_TYPE action = ACTION_TYPE.AT_MAX;
        int         count  = mAction.Length;

        for (int i = 0; i < count; ++i)
        {
            if (mLayout.getUIObject(obj) == mAction[i])
            {
                action = (ACTION_TYPE)i;
                break;
            }
        }
        if (action != ACTION_TYPE.AT_MAX)
        {
            CSConfirmAction confirm = mSocketNetManager.createPacket <CSConfirmAction>();
            confirm.mAction.mValue = (byte)action;
            mSocketNetManager.sendMessage(confirm);
            afterActionSelected();
        }
    }
Example #18
0
        static void Generate(string CaseName, ACTION_TYPE Type, int MustCorrectCases, int CharacterLimit)
        {
            UInt64 Counter = 0;
            int    CounterOfCorrectCases = 0;
            bool   Correctness;

            //
            // Open files to save the results
            //
            StreamWriter TestCaseWithErrorFile    = new StreamWriter(@"..\..\..\script-test-cases\" + CaseName + "-wrong.txt");
            StreamWriter TestCaseWithoutErrorFile = new StreamWriter(@"..\..\..\script-test-cases\" + CaseName + "-correct.txt");

            //
            // This the count of correct values
            //
            while (true)
            {
                Counter++;

                Correctness = GenerateStatement(Type, TestCaseWithErrorFile, TestCaseWithoutErrorFile, CharacterLimit, Counter);

                if (Correctness)
                {
                    CounterOfCorrectCases++;

                    if (CounterOfCorrectCases >= MustCorrectCases)
                    {
                        break;
                    }
                }
            }

            //
            // Close the files
            //
            TestCaseWithErrorFile.Close();
            TestCaseWithoutErrorFile.Close();
        }
Example #19
0
    //------------------------------------------------------------------------------------------------------
    protected void onActionClicked(GameObject obj)
    {
        ACTION_TYPE action = ACTION_TYPE.AT_MAX;
        int         count  = mAction.Length;

        for (int i = 0; i < count; ++i)
        {
            if (mLayout.getUIObject(obj) == mAction[i])
            {
                action = (ACTION_TYPE)i;
                break;
            }
        }
        if (action != ACTION_TYPE.AT_MAX)
        {
            CSConfirmAction confirm = mSocketManager.createPacket <CSConfirmAction>();
            confirm.mAction.mValue = (byte)action;
            mSocketManager.sendMessage(confirm);
            afterActionSelected();
            // 通知其他布局行为已经选择
            mScriptMahjongHandIn.notifyAbleToPengOrGang(PLAYER_POSITION.PP_MYSELF, MAHJONG.M_MAX);
        }
    }
        public FormEmployerAddEdit(FormEmployer frm, ACTION_TYPE action)
        {
            InitializeComponent();
            this.frmParent              = frm;
            this.action                 = action;
            cboRole.DataSource          = Enum.GetValues(typeof(Account.RoleType));
            this.txtTimeCreated.Enabled = false;
            switch (this.action)
            {
            case ACTION_TYPE.VIEW:
                this.DisableEdit();
                break;

            case ACTION_TYPE.CREATE:
                this.SetActionButton("Thêm");
                this.txtTimeCreated.Visible = false;
                this.lblTimeCreated.Visible = false;
                break;

            case ACTION_TYPE.EDIT:
                this.SetActionButton("Sửa");
                break;
            }
        }
Example #21
0
    public static BaseAction GetActionObject(ACTION_TYPE pActionType, BaseAction pBaseAction)
    {
        switch (pActionType)
        {
        case ACTION_TYPE.DESTROY_BLOCK:
            return(new DestroyBlock(pBaseAction.m_NxN));

        case ACTION_TYPE.DESTROY_BY_TYPE:
            return(new DestroyByTag(pBaseAction.m_TargetTag));

        case ACTION_TYPE.DESTROY_ALL_BOARD:
            return(new DestroyAllBoard());

        case ACTION_TYPE.DESTROY_CROSS:
            return(new DestroyCross(pBaseAction.m_NxN));

        case ACTION_TYPE.DESTROY_DIAGONAL:
            return(new DestroyDiagonal());

        case ACTION_TYPE.TRANSFORM_INTO_SPECIAL:
            return(new TransformIntoSpecial(pBaseAction.m_TargetTag, pBaseAction.m_TagToTransformTo));
        }
        return(new BaseAction());
    }
Example #22
0
 public void ChargerCarte(string path)
 {
     carte      = new Carte(path);
     actionType = ACTION_TYPE.ACTION_TYPE_CHANGEMENT_CARTE;
 }
Example #23
0
 private bool checkCurrentTestAction(ACTION_TYPE act)
 {
     if (getCurrentTestAction() == null) return false;
     return getCurrentTestAction().getActionType() == act;
 }
Example #24
0
 public ReplayAction(int seatindex, int act, int card)
 {
     si   = seatindex;
     type = (ACTION_TYPE)act;
     pai  = card;
 }
Example #25
0
    // 玩家请求确认操作
    public void playerConfirmAction(Character player, ACTION_TYPE type)
    {
        if (!mWaitList.ContainsKey(player))
        {
            UnityUtility.logError("player has no action : name : " + player.getName() + ", action : " + type);
        }
        MahjongAction        action     = null;
        List <MahjongAction> actionList = mWaitList[player].mActionList;
        int actionCount = actionList.Count;

        for (int i = 0; i < actionCount; ++i)
        {
            if (actionList[i].mType == type)
            {
                action = actionList[i];
                break;
            }
        }
        if (action == null)
        {
            return;
        }
        mWaitList[player].mConfirmedAction = action;
        // 胡牌的优先级最高,如果有玩家选择胡牌,则忽略其他玩家的操作
        if (action.mType == ACTION_TYPE.AT_HU)
        {
            // 游戏状态设置为正常游戏
            notifyPlayState(MAHJONG_PLAY_STATE.MPS_NORMAL_GAMING);
            CommandCharacterHu cmd = mCommandSystem.newCmd <CommandCharacterHu>();
            mCommandSystem.pushCommand(cmd, player);

            // 有玩家胡牌后则结束游戏
            //End;
        }
        else
        {
            bool          allConfirm          = true;
            Character     highestActionPlayer = null;
            MahjongAction highestAction       = null;
            foreach (var wait in mWaitList)
            {
                if (wait.Value.mConfirmedAction == null)
                {
                    allConfirm = false;
                    break;
                }
                if (highestAction == null || highestAction.mType > wait.Value.mConfirmedAction.mType)
                {
                    highestAction       = wait.Value.mConfirmedAction;
                    highestActionPlayer = wait.Value.mPlayer;
                }
            }
            // 如果全部玩家都已经确认操作了,允许优先级最高的操作进行
            if (allConfirm)
            {
                // 先获得信息,因为在设置状态时会将列表清空
                WaitActionInfo info = mWaitList[highestActionPlayer];
                // 游戏状态设置为正常游戏
                notifyPlayState(MAHJONG_PLAY_STATE.MPS_NORMAL_GAMING);
                if (highestAction.mType == ACTION_TYPE.AT_GANG)
                {
                    // 自己摸的牌开杠
                    if (info.mDroppedPlayer == info.mPlayer)
                    {
                        ;
                    }
                    // 别人打出牌开杠
                    else
                    {
                        ;
                    }
                    CommandCharacterGang cmd = mCommandSystem.newCmd <CommandCharacterGang>();
                    cmd.mDroppedPlayer = info.mDroppedPlayer;
                    cmd.mMahjong       = info.mMahjong;
                    mCommandSystem.pushCommand(cmd, info.mPlayer);

                    // 还有牌,玩家杠了一张牌以后需要再摸一张
                    if (mMahjongPool.Count > 0)
                    {
                        CommandCharacterGet cmdGet = mCommandSystem.newCmd <CommandCharacterGet>();
                        cmdGet.mMahjong = requestGet();
                        mCommandSystem.pushCommand(cmdGet, info.mPlayer);
                    }
                    // 没有牌了则平局
                    else
                    {
                        //End;
                    }
                }
                else if (highestAction.mType == ACTION_TYPE.AT_PENG)
                {
                    CommandCharacterPeng cmd = mCommandSystem.newCmd <CommandCharacterPeng>();
                    cmd.mDroppedPlayer = info.mDroppedPlayer;
                    cmd.mMahjong       = info.mMahjong;
                    mCommandSystem.pushCommand(cmd, info.mPlayer);

                    CommandCharacterAskDrop cmdAskDrop = mCommandSystem.newCmd <CommandCharacterAskDrop>();
                    mCommandSystem.pushCommand(cmdAskDrop, info.mPlayer);
                }
                else if (highestAction.mType == ACTION_TYPE.AT_PASS)
                {
                    // 如果是自己摸了一张牌,选择了pass,则需要自己打一张牌出来
                    if (info.mDroppedPlayer == info.mPlayer)
                    {
                        CommandCharacterAskDrop cmd = mCommandSystem.newCmd <CommandCharacterAskDrop>();
                        mCommandSystem.pushCommand(cmd, info.mPlayer);
                    }
                    else
                    {
                        // 还有牌则通知下一家摸牌
                        if (mMahjongPool.Count > 0)
                        {
                            PLAYER_POSITION     nextPosition = (PLAYER_POSITION)(((int)(info.mDroppedPlayer.getCharacterData().mPosition) + 1) % (int)PLAYER_POSITION.PP_MAX);
                            CommandCharacterGet cmdGet       = mCommandSystem.newCmd <CommandCharacterGet>();
                            cmdGet.mMahjong = requestGet();
                            mCommandSystem.pushCommand(cmdGet, getCharacterByPosition(nextPosition));
                        }
                        // 没有牌了则平局
                        else
                        {
                            //End;
                        }
                    }
                }
            }
        }
    }
Example #26
0
 public Action(ACTION_TYPE T, GameObject sub)
 {
     type    = T;
     SUBJECT = sub;
     MOVEPOS = new int[2];
 }
 public Action()
 {
     action_type = ACTION_TYPE.NO_ACTION;
 }
Example #28
0
        private static bool GenerateStatement
        (
            ACTION_TYPE Type,
            StreamWriter TestCaseWithErrorFile,
            StreamWriter TestCaseWithoutErrorFile,
            int Limit,
            UInt64 Counter
        )
        {
            string Result     = string.Empty;
            string Sentence   = string.Empty;
            string Script     = string.Empty;
            bool   EvalResult = false;

            StatementGenerator.ResetDepth();


            switch (Type)
            {
            case ACTION_TYPE.CREATE_EXPRESSIONS:

                Sentence = StatementGenerator.EXPRESSION();

                //
                // Avoid big statements!
                //
                if (!(Sentence.Length <= Limit))
                {
                    return(false);
                }

                Script     = "x = " + Sentence + "; test_statement(x);";
                EvalResult = HighLevelScriptGen.EvaluateExpression(Sentence, ref Result);

                break;

            case ACTION_TYPE.CREATE_CONDITIONAL_STATEMENTS:

                Sentence = StatementGenerator.IF_STATEMENT(false);

                if (!(Sentence.Length <= Limit))
                {
                    return(false);
                }

                Script     = Sentence;
                EvalResult = HighLevelScriptGen.EvaluateConditionalStatement(Sentence, ref Result);

                break;

            case ACTION_TYPE.CREATE_CONDITIONAL_STATEMENTS_COMBINED_WITH_OTHER_STATEMENT:

                Sentence = StatementGenerator.IF_STATEMENT(true);

                if (!(Sentence.Length <= Limit))
                {
                    return(false);
                }

                Script     = Sentence;
                EvalResult = HighLevelScriptGen.EvaluateConditionalStatement(Sentence, ref Result);

                break;

            case ACTION_TYPE.CREATE_FOR_LOOP:

                Sentence = StatementGenerator.FOR_STATEMENT(false);

                if (!(Sentence.Length <= Limit))
                {
                    return(false);
                }

                Script     = Sentence;
                EvalResult = HighLevelScriptGen.EvaluateLoops(Sentence, ref Result);

                break;

            case ACTION_TYPE.CREATE_FOR_LOOP_COMBINED_WITH_OTHER_STATEMENT:

                Sentence = StatementGenerator.FOR_STATEMENT(true);

                if (!(Sentence.Length <= Limit))
                {
                    return(false);
                }

                Script     = Sentence;
                EvalResult = HighLevelScriptGen.EvaluateLoops(Sentence, ref Result);

                break;

            case ACTION_TYPE.CREATE_WHILE_LOOP:

                Sentence = StatementGenerator.WHILE_STATEMENT(false);

                if (!(Sentence.Length <= Limit))
                {
                    return(false);
                }

                Script     = Sentence;
                EvalResult = HighLevelScriptGen.EvaluateLoops(Sentence, ref Result);

                break;

            case ACTION_TYPE.CREATE_WHILE_LOOP_COMBINED_WITH_OTHER_STATEMENT:

                Sentence = StatementGenerator.WHILE_STATEMENT(true);

                if (!(Sentence.Length <= Limit))
                {
                    return(false);
                }

                Script     = Sentence;
                EvalResult = HighLevelScriptGen.EvaluateLoops(Sentence, ref Result);

                break;

            case ACTION_TYPE.CREATE_DO_WHILE_LOOP:

                Sentence = StatementGenerator.DO_WHILE_STATEMENT(false);

                if (!(Sentence.Length <= Limit))
                {
                    return(false);
                }

                Script     = Sentence;
                EvalResult = HighLevelScriptGen.EvaluateLoops(Sentence, ref Result);

                break;

            case ACTION_TYPE.CREATE_DO_WHILE_LOOP_COMBINED_WITH_OTHER_STATEMENT:

                Sentence = StatementGenerator.DO_WHILE_STATEMENT(true);

                if (!(Sentence.Length <= Limit))
                {
                    return(false);
                }

                Script     = Sentence;
                EvalResult = HighLevelScriptGen.EvaluateLoops(Sentence, ref Result);

                break;

            default:

                //
                // Invalid value
                //
                return(false);
            }


            Console.WriteLine(Counter + "\n\n" + Script + "\n\n" + Result + "\n");
            Console.WriteLine("------------------------------------------------------------");

            if (EvalResult)
            {
                TestCaseWithoutErrorFile.WriteLine(Counter.ToString());
                TestCaseWithoutErrorFile.WriteLine(Script);
                TestCaseWithoutErrorFile.WriteLine(Result);
                TestCaseWithoutErrorFile.WriteLine("$end$");

                return(true);
            }
            else
            {
                TestCaseWithErrorFile.WriteLine(Counter.ToString());
                TestCaseWithErrorFile.WriteLine(Script);
                TestCaseWithErrorFile.WriteLine(Result);
                TestCaseWithErrorFile.WriteLine("$end$");

                return(false);
            }
        }
Example #29
0
	public void ImportData(JSONObject json_data)
	{
		m_action_type = (ACTION_TYPE)(int)json_data["m_action_type"].Number;
		m_ease_type = (EasingEquation)(int)json_data["m_ease_type"].Number;
		m_use_gradient_start = json_data["m_use_gradient_start"].Boolean;
		m_use_gradient_end = json_data["m_use_gradient_end"].Boolean;
		m_force_same_start_time = json_data["m_force_same_start_time"].Boolean;
		m_letter_anchor_start = (int)json_data["m_letter_anchor_start"].Number;
		m_letter_anchor_end = (int)json_data["m_letter_anchor_end"].Number;
		m_letter_anchor_2_way = json_data["m_letter_anchor_2_way"].Boolean;
		m_offset_from_last = json_data["m_offset_from_last"].Boolean;
		m_position_axis_ease_data.ImportData(json_data["m_position_axis_ease_data"].Obj);
		m_rotation_axis_ease_data.ImportData(json_data["m_rotation_axis_ease_data"].Obj);
		m_scale_axis_ease_data.ImportData(json_data["m_scale_axis_ease_data"].Obj);

		if (m_use_gradient_start)
			m_start_vertex_colour.ImportData(json_data["m_start_vertex_colour"].Obj);
		else
			m_start_colour.ImportData(json_data["m_start_colour"].Obj);
		if (m_use_gradient_end)
			m_end_vertex_colour.ImportData(json_data["m_end_vertex_colour"].Obj);
		else
			m_end_colour.ImportData(json_data["m_end_colour"].Obj);

		m_start_euler_rotation.ImportData(json_data["m_start_euler_rotation"].Obj);
		m_end_euler_rotation.ImportData(json_data["m_end_euler_rotation"].Obj);
		m_start_pos.ImportData(json_data["m_start_pos"].Obj);
		m_end_pos.ImportData(json_data["m_end_pos"].Obj);
		m_start_scale.ImportData(json_data["m_start_scale"].Obj);
		m_end_scale.ImportData(json_data["m_end_scale"].Obj);
		m_delay_progression.ImportData(json_data["m_delay_progression"].Obj);
		m_duration_progression.ImportData(json_data["m_duration_progression"].Obj);


		m_audio_effects = new List<AudioEffectSetup>();
		AudioEffectSetup audio_effect;
		foreach (var audio_data in json_data["AUDIO_EFFECTS_DATA"].Array)
		{
			audio_effect = new AudioEffectSetup();
			audio_effect.ImportData(audio_data.Obj);
			m_audio_effects.Add(audio_effect);
		}

		m_particle_effects = new List<ParticleEffectSetup>();
		ParticleEffectSetup particle_effect;
		foreach (var particle_data in json_data["PARTICLE_EFFECTS_DATA"].Array)
		{
			particle_effect = new ParticleEffectSetup();
			particle_effect.ImportData(particle_data.Obj);
			m_particle_effects.Add(particle_effect);
		}
	}
Example #30
0
        // Functions
        //-----------------------------------------------------------------
        /// <summary>
        /// Undo작업을 위한 Unit을 생성한다.
        /// 생성과 동시에 COMMAND에 맞는 현재 상태를 저장하며, 이후 생성된 Unit에 Refresh()를 호출해야한다.
        /// 만약 Undo를 한 상태에서 이 함수를 호출한다면 되돌려진 Undo 기록은 삭제된다.
        /// </summary>
        /// <param name="command"></param>
        /// <param name="keyObj"></param>
        /// <param name="actionType"></param>
        /// <param name="label"></param>
        /// <param name="portrait"></param>
        /// <returns></returns>
        public apUndoUnitBase MakeUndo(COMMAND command, object keyObj, ACTION_TYPE actionType, string label, apPortrait portrait)
        {
            if (_curPortrait != portrait || _curPortrait == null)
            {
                //Portrait가 다르면 자동으로 Undo는 리셋
                Clear();

                _curPortrait = portrait;
                if (_curPortrait == null)
                {
                    return(null);
                }
            }

            //Make 과정에서는 항상
            //새로운("또는 연결된") 유닛이 [마지막]이어야한다.
            //curUnit이 중간에 있다면 그 사이는 삭제되어야 한다.

            bool isSameUnit = true;

            if (_lastUnit == null)
            {
                isSameUnit = false;
            }
            else if (!_lastUnit.IsSameUnit((int)command, keyObj, actionType))
            {
                isSameUnit = false;
            }
            else if (!_lastUnit.IsContinuedRecord())
            {
                //연속으로 기록이 불가능할 경우에도 체크
                isSameUnit = false;
            }

            if (isSameUnit)
            {
                _curUnit = _lastUnit;
                return(_lastUnit);
            }

            //Debug.Log("Make Undo");

            apUndoUnitBase newUndoUnit = null;

            //타입에 따라 다른 상속된 클래스로 생성한다.
            switch (command)
            {
            case COMMAND.MeshVertex:
                newUndoUnit = new apUndoUnit_MeshVertex();
                break;

            default:
                Debug.LogError("Undo 에러 : 정의되지 않은 Command [" + command + "]");
                return(null);
            }

            newUndoUnit.Init((int)command, keyObj, actionType, label);
            newUndoUnit.SavePrevStatus();            //<<현재 상태를 저장하자

            //리스트에 추가하기 전에
            //_curUnit의 뒤쪽에 위치한 객체들은 모두 삭제하자
            //[시작] ..... [cur] ...... [last]
            //< [시작] ....[cur] > + [new]        (~[last] 삭제)
            //만약 cur가 없거나(리스트가 비어있음) "cur = last"라면 패스한다.
            if (_curUnit != null && _curUnit != _lastUnit)
            {
                _iCurUnit = -1;
                //0, 1, 2, 3, 4 [5]
                //3 삭제
                //5 - 3 = 2 (3, 4)
                for (int i = 0; i < _units.Count; i++)
                {
                    if (_curUnit == _units[i])
                    {
                        _iCurUnit = i;
                        break;
                    }
                }
                if (_iCurUnit > 0)
                {
                    int iRemove = _iCurUnit + 1;
                    int nRemove = _units.Count - iRemove;
                    if (nRemove > 0)
                    {
                        _units.RemoveRange(iRemove, nRemove);
                    }
                }

                _lastUnit = _curUnit;
            }

            //이제 맨 뒤에 newUndoUnit을 붙이자
            _units.Add(newUndoUnit);
            _lastUnit = newUndoUnit;
            _curUnit  = _lastUnit;

            //Debug.Log("Make New Undo [" + _units.Count + "]");

            return(newUndoUnit);
        }
Example #31
0
		public void ImportData(Boomlagoon.JSON.JSONObject json_data, string assetNameSuffix = "", float timing_scale = -1)
		{	
			m_action_type = (ACTION_TYPE) (int) json_data["m_action_type"].Number;
			m_ease_type = (EasingEquation) (int) json_data["m_ease_type"].Number;
			m_force_same_start_time = json_data["m_force_same_start_time"].Boolean;
			m_letter_anchor_start = (int) json_data["m_letter_anchor_start"].Number;
			m_letter_anchor_end = (int) json_data["m_letter_anchor_end"].Number;
			m_letter_anchor_2_way = json_data["m_letter_anchor_2_way"].Boolean;
			m_offset_from_last = json_data["m_offset_from_last"].Boolean;
			m_position_axis_ease_data.ImportData(json_data["m_position_axis_ease_data"].Obj);
			m_rotation_axis_ease_data.ImportData(json_data["m_rotation_axis_ease_data"].Obj);
			m_scale_axis_ease_data.ImportData(json_data["m_scale_axis_ease_data"].Obj);

			m_colour_transition_active = json_data.ContainsKey("m_colour_transition_active") ? json_data ["m_colour_transition_active"].Boolean : true;
			m_position_transition_active = json_data.ContainsKey("m_position_transition_active") ? json_data ["m_position_transition_active"].Boolean : true;
			m_local_rotation_transition_active = json_data.ContainsKey("m_local_rotation_transition_active") ? json_data ["m_local_rotation_transition_active"].Boolean : true;
			m_local_scale_transition_active = json_data.ContainsKey("m_local_scale_transition_active") ? json_data ["m_local_scale_transition_active"].Boolean : true;
			m_global_rotation_transition_active = json_data.ContainsKey("m_global_rotation_transition_active") ? json_data ["m_global_rotation_transition_active"].Boolean : true;
			m_global_scale_transition_active = json_data.ContainsKey("m_global_scale_transition_active") ? json_data ["m_global_scale_transition_active"].Boolean : true;


			if(json_data.ContainsKey("m_start_colour"))
				m_start_colour.ImportData(json_data["m_start_colour"].Obj);
			if(json_data.ContainsKey("m_end_colour"))
				m_end_colour.ImportData(json_data["m_end_colour"].Obj);

			if(json_data.ContainsKey("m_start_vertex_colour"))
				m_start_colour.ImportData(json_data["m_start_vertex_colour"].Obj);
			if(json_data.ContainsKey("m_end_vertex_colour"))
				m_start_colour.ImportData(json_data["m_end_vertex_colour"].Obj);

			if(json_data.ContainsKey("m_use_gradient_start"))
				// Legacy setting. Need to check for it for backwards compatibility
				m_start_colour.UseColourGradients = json_data["m_use_gradient_start"].Boolean;

			if(json_data.ContainsKey("m_use_gradient_end"))
				// Legacy setting. Need to check for it for backwards compatibility
				m_end_colour.UseColourGradients = json_data["m_use_gradient_end"].Boolean;

			
			m_start_pos.ImportData(json_data["m_start_pos"].Obj);
			m_end_pos.ImportData(json_data["m_end_pos"].Obj);

			m_start_euler_rotation.ImportData(json_data["m_start_euler_rotation"].Obj);
			m_end_euler_rotation.ImportData(json_data["m_end_euler_rotation"].Obj);
			m_start_scale.ImportData(json_data["m_start_scale"].Obj);
			m_end_scale.ImportData(json_data["m_end_scale"].Obj);

			m_global_start_euler_rotation.ImportData(json_data["m_global_start_euler_rotation"].Obj);
			m_global_end_euler_rotation.ImportData(json_data["m_global_end_euler_rotation"].Obj);
			m_global_start_scale.ImportData(json_data["m_global_start_scale"].Obj);
			m_global_end_scale.ImportData(json_data["m_global_end_scale"].Obj);

			m_duration_progression.ImportData(json_data["m_duration_progression"].Obj);
			m_delay_progression.ImportData(json_data["m_delay_progression"].Obj);

			if(timing_scale != -1)
			{
				// Scale delay easing by the provided timing scale
				if(m_delay_progression.Progression != (int) ValueProgression.Constant)
				{
					float from = m_delay_progression.ValueFrom;
					float to = m_delay_progression.ValueTo;
					float then = m_delay_progression.ValueThen;

					if(m_delay_progression.Progression == (int) ValueProgression.Eased)
					{
						if(m_delay_progression.UsingThirdValue)
							m_delay_progression.SetEased( from * timing_scale, to * timing_scale, then * timing_scale);
						else
							m_delay_progression.SetEased( from * timing_scale, to * timing_scale);
					}
					else if(m_delay_progression.Progression == (int) ValueProgression.EasedCustom)
					{
						m_delay_progression.SetEasedCustom( from * timing_scale, to * timing_scale);
					}
					else if(m_delay_progression.Progression == (int) ValueProgression.Random)
					{
						m_delay_progression.SetRandom( from * timing_scale, to * timing_scale, m_delay_progression.UniqueRandomRaw);
					}
				}
			}
			
			m_audio_effects = new List<AudioEffectSetup>();
			AudioEffectSetup audio_effect;
			foreach(Boomlagoon.JSON.JSONValue audio_data in json_data["AUDIO_EFFECTS_DATA"].Array)
			{
				audio_effect = new AudioEffectSetup();
				audio_effect.ImportData(audio_data.Obj);
				m_audio_effects.Add(audio_effect);
			}
			
			m_particle_effects = new List<ParticleEffectSetup>();
			ParticleEffectSetup particle_effect;
			foreach(Boomlagoon.JSON.JSONValue particle_data in json_data["PARTICLE_EFFECTS_DATA"].Array)
			{
				particle_effect = new ParticleEffectSetup();
				particle_effect.ImportData(particle_data.Obj, assetNameSuffix);
				m_particle_effects.Add(particle_effect);
			}
		}
Example #32
0
 //特殊(ステージクリア時などのリアクション)
 private void SetSpecialAnimation()
 {
     _clone = (GameObject)Instantiate(_player_animes[(int)ANIM_TYPE.ANIM_TYPE_SPECIAL], gameObject.transform.position, Quaternion.identity);
     _clone.transform.parent = gameObject.transform;
     _action_type            = ACTION_TYPE.ACTION_TYPE_WALK;
 }
Example #33
0
 public void HandleAction(ACTION_TYPE type)
 {
     if (type == ACTION_TYPE.PARENT_TRIGGER_ACTIVATED) {
         myGlowEnabled = true;
     }
 }
Example #34
0
 //直立
 private void SetWaitAnimation()
 {
     _player_animes[(int)ANIM_TYPE.ANIM_TYPE_WAIT].SetActive(true);
     _action_type = ACTION_TYPE.ACTION_TYPE_STOP;
 }
Example #35
0
 //悩み
 private void SetBotheredAnimation()
 {
     _reactionEffect.ReactionGenerate(ReactionEffectGenerator.REACTION_TYPE.REACTION_TYPE_QUESTION);
     _player_animes[(int)ANIM_TYPE.ANIM_TYPE_BOTHERED].SetActive(true);
     _action_type = ACTION_TYPE.ACTION_TYPE_STOP;
 }
Example #36
0
    /*アニメーション切り替え
     * (SpriteStudioでの切り替え方法がわからなかったため、GameObjectのactive状態で切り替えを行う)*/

    //歩き
    private void SetWalkAnimation()
    {
        _player_animes[(int)ANIM_TYPE.ANIM_TYPE_WALK].SetActive(true);
        _action_type = ACTION_TYPE.ACTION_TYPE_WALK;
    }
        public void ImportData(JSONObject json_data)
        {
            m_action_type           = (ACTION_TYPE)(int)json_data["m_action_type"].Number;
            m_ease_type             = (EasingEquation)(int)json_data["m_ease_type"].Number;
            m_use_gradient_start    = json_data["m_use_gradient_start"].Boolean;
            m_use_gradient_end      = json_data["m_use_gradient_end"].Boolean;
            m_force_same_start_time = json_data["m_force_same_start_time"].Boolean;
            m_letter_anchor_start   = (int)json_data["m_letter_anchor_start"].Number;
            m_letter_anchor_end     = (int)json_data["m_letter_anchor_end"].Number;
            m_letter_anchor_2_way   = json_data["m_letter_anchor_2_way"].Boolean;
            m_offset_from_last      = json_data["m_offset_from_last"].Boolean;
            m_position_axis_ease_data.ImportData(json_data["m_position_axis_ease_data"].Obj);
            m_rotation_axis_ease_data.ImportData(json_data["m_rotation_axis_ease_data"].Obj);
            m_scale_axis_ease_data.ImportData(json_data["m_scale_axis_ease_data"].Obj);

            if (m_use_gradient_start)
            {
                m_start_vertex_colour.ImportData(json_data["m_start_vertex_colour"].Obj);
            }
            else
            {
                m_start_colour.ImportData(json_data["m_start_colour"].Obj);
            }
            if (m_use_gradient_end)
            {
                m_end_vertex_colour.ImportData(json_data["m_end_vertex_colour"].Obj);
            }
            else
            {
                m_end_colour.ImportData(json_data["m_end_colour"].Obj);
            }

            m_start_euler_rotation.ImportData(json_data["m_start_euler_rotation"].Obj);
            m_end_euler_rotation.ImportData(json_data["m_end_euler_rotation"].Obj);
            m_start_pos.ImportData(json_data["m_start_pos"].Obj);
            m_end_pos.ImportData(json_data["m_end_pos"].Obj);
            m_start_scale.ImportData(json_data["m_start_scale"].Obj);
            m_end_scale.ImportData(json_data["m_end_scale"].Obj);
            m_delay_progression.ImportData(json_data["m_delay_progression"].Obj);
            m_duration_progression.ImportData(json_data["m_duration_progression"].Obj);


            m_audio_effects = new List <AudioEffectSetup>();
            AudioEffectSetup audio_effect;

            foreach (JSONValue audio_data in json_data["AUDIO_EFFECTS_DATA"].Array)
            {
                audio_effect = new AudioEffectSetup();
                audio_effect.ImportData(audio_data.Obj);
                m_audio_effects.Add(audio_effect);
            }

            m_particle_effects = new List <ParticleEffectSetup>();
            ParticleEffectSetup particle_effect;

            foreach (JSONValue particle_data in json_data["PARTICLE_EFFECTS_DATA"].Array)
            {
                particle_effect = new ParticleEffectSetup();
                particle_effect.ImportData(particle_data.Obj);
                m_particle_effects.Add(particle_effect);
            }
        }
Example #38
0
 public void initialize(CombatAction.WEAPON_TYPE weaponType, CombatAction.ACTION_TYPE actionType)
 {
     this.WeaponType = weaponType;
     this.ActionType = actionType;
 }