상속: CookComputing.XmlRpc.XmlRpcClientProtocol
예제 #1
0
 public void ChangeState(StateName state)
 {
     currentState = state;
     Color color;
     switch(state)
     {
         case StateName.Actived:
             color = App.GetResourceByKey<SolidColorBrush>("COLOR_FONT_ACTIVE").Color;
             break;
         case StateName.Inactived:
             color = App.GetResourceByKey<SolidColorBrush>("COLOR_FONT_INACTIVE").Color;
             break;
         case StateName.Selected:
             color = App.GetResourceByKey<SolidColorBrush>("COLOR_PRIMARY").Color;
             break;
         default :
             color = App.GetResourceByKey<SolidColorBrush>("COLOR_FONT_ACTIVE").Color;
             break;
     }
     if(ca==null)
     {
         ca = new ColorAnimation {Duration =App.COLOR_CHANGEDURATION};
     }
     ca.To = color;
     if(sb==null)
     {
         sb = new Storyboard();
         sb.Children.Add(ca);
         Storyboard.SetTarget(ca, txt);
         Storyboard.SetTargetProperty(ca, new PropertyPath("(Foreground).(Color)"));
     }
     sb.Begin();
 }
예제 #2
0
파일: ShipMan.cs 프로젝트: xfanw/Game
        public static ShipState GetState(StateName stateName)
        {
            switch (stateName)
            {
            case StateName.Ready:
            {
                return(_ShipMan.ReadyState);
            }

            case StateName.Flying:
            {
                return(_ShipMan.FlyingState);
            }

            case StateName.Dead:
            {
                return(_ShipMan.DeadState);
            }

            default:
            {
                return(null);
            }
            }
        }
예제 #3
0
 void PlayBallSound(StateName previousStateName)
 {
     if (previousStateName == StateName.Compressed || previousStateName == StateName.Rebound)
     {
         AudioSource.PlayClipAtPoint(launchSound, transform.position);
     }
 }
    private void InsertData(DataTable dt)
    {
        int UpdateCount = 0, InsertCount = 0;

        try
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                #region Value Initialization

                CountryName = dt.Rows[i][CountryNameColumn].ToString().Trim();
                StateName   = dt.Rows[i][StateNameColumn].ToString().Trim();
                CityName    = dt.Rows[i][CityNameColumn].ToString().Trim();

                #endregion

                int CountryId = new Country()
                {
                    eStatus = (int)eStatus.Active, CountryName = CountryName.ToLower()
                }.SelectList <Country>()[0].CountryId.Value;

                int StateId = 0;
                if (!StateName.zIsNullOrEmpty())
                {
                    StateId = new State()
                    {
                        CountryId = CountryId, StateName = StateName, eStatus = (int)eStatus.Active
                    }
                }
                .SelectList <State>()[0].StateId.Value;

                DataTable dtCity = new Query()
                {
                    CountryId  = CountryId,
                    StateId    = StateId,
                    CityName   = CityName.zFirstCharToUpper(),
                    eStatusNot = (int)eStatus.Delete
                }.Select(eSP.qry_City);

                var objCity = new City()
                {
                    CityId   = dtCity.Rows.Count > 0 ? dtCity.Rows[0][CS.CityId].zToInt() : (int?)null,
                    StateId  = StateId,
                    CityName = CityName,
                };

                if (objCity.CityId.HasValue)
                {
                    objCity.Update();
                    UpdateCount++;
                }
                else
                {
                    objCity.eStatus = (int)eStatus.Active;
                    objCity.Insert();
                    InsertCount++;
                }
            }
    private void InsertData(DataTable dt)
    {
        int UpdateCount = 0, InsertCount = 0;

        try
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                #region Value Initialization

                CountryName = dt.Rows[i][CountryNameColumn].ToString().Trim();
                StateName   = dt.Rows[i][StateNameColumn].ToString().Trim();
                Description = dt.Rows[i][DescriptionColumn].ToString().Trim();

                #endregion

                var objCountry = new Country()
                {
                    CountryName = CountryName.ToLower(), eStatus = (int)eStatus.Active
                }.SelectList <Country>()[0];

                DataTable dtState = new Query()
                {
                    CountryId  = objCountry.CountryId,
                    StateName  = StateName,
                    eStatusNot = (int)eStatus.Delete
                }.Select(eSP.qry_State);

                var objState = new State()
                {
                    CountryId   = objCountry.CountryId,
                    StateId     = dtState.Rows.Count > 0 ? dtState.Rows[0][CS.StateId].zToInt() : (int?)null,
                    StateName   = StateName.zFirstCharToUpper(),
                    Description = Description,
                };

                if (objState.StateId.HasValue)
                {
                    objState.Update();
                    UpdateCount++;
                }
                else
                {
                    objState.eStatus = (int)eStatus.Active;
                    objState.Insert();
                    InsertCount++;
                }
            }

            CU.SetSuccessExcelMessage(InsertCount, UpdateCount, "State");
        }
        catch (Exception ex)
        {
            CU.ZMessage(eMsgType.Error, string.Empty, ex.Message, 0);
        }

        LoadStateGrid(ePageIndex.Custom);
    }
예제 #6
0
 /// <summary>
 /// 初始化状态
 /// </summary>
 /// <param name="name"></param>
 /// <param name="machine"></param>
 public virtual void InitState(StateName name, StateMachine machine)
 {
     Name         = name;
     Machine      = machine;
     Transitions  = new Dictionary <TransitionName, Transition>();
     DurationTime = 0;
     IsRunContineStartAndUpdate = true;
     RemoveStateEvent();
 }
예제 #7
0
 private string PrintTag(StateName tag)
 {
     string output = "";
     if (tag < 0)
     {
         tag = ~tag;
         output += "~";
     }
     return output + tag.ToString();
 }
예제 #8
0
 /// <summary>
 /// Subtree for the user switching the lamp on/off.
 /// </summary>
 /// <param name="switchTo">THe desired state of StateName.IsTurnedOn after executing the tree.</param>
 private Node ST_Switch(SmartCharacter user, StateName switchTo)
 {
     return new Sequence(
         user.Node_Require(StateName.RoleActor, StateName.IsStanding),
         this.Node_Require(StateName.RoleTelevision, ~switchTo),
         user.Node_GoTo(turnOnOffStandPoint.position),
         user.Node_OrientTowards(onOffSwitch.transform.position),
         user.Node_StartInteraction(FullBodyBipedEffector.LeftHand, onOffSwitch),
         user.Node_WaitForTrigger(FullBodyBipedEffector.LeftHand),
         user.Node_StopInteraction(FullBodyBipedEffector.LeftHand),
         this.Node_Set(switchTo)
         );
 }
예제 #9
0
 /// <summary>
 /// Subtree for the user switching the lamp on/off.
 /// </summary>
 /// <param name="switchTo">THe desired state of StateName.IsTurnedOn after executing the tree.</param>
 private Node ST_Switch(SmartCharacter user, StateName switchTo)
 {
     return new Sequence(
         user.Node_Require(StateName.RoleActor, StateName.IsStanding),
         this.Node_Require(StateName.RoleLamp, ~switchTo),
         user.Node_GoTo(standPoint.position),
         user.Node_OrientTowards(lightSwitch.transform.position),
         user.Node_StartInteraction(FullBodyBipedEffector.RightHand, lightSwitch.interactionObject),
         user.Node_WaitForFinish(FullBodyBipedEffector.RightHand),
         user.Node_StopInteraction(FullBodyBipedEffector.RightHand),
         new LeafInvoke(() => lightSwitch.Set(switchTo > 0)),
         this.Node_Set(switchTo)
         );
 }
    /// <summary>
    /// コンストラクタ
    /// </summary>
    void Start()
	{
		BMController = GetComponent<BasicMovementController>();
		Animator = transform.FindChild("Sprite").GetComponent<Animator>();
		SpriteRenderer = transform.FindChild("Sprite").GetComponent<SpriteRenderer>();

		layerMasks.Ladders = LayerMask.GetMask(new string[] { "Ladders" });
		layerMasks.LadderTops = LayerMask.GetMask(new string[] { "LadderTops" });
		layerMasks.LadderSpines = LayerMask.GetMask(new string[] { "LadderSpines" });
		layerMasks.LadderBottoms = LayerMask.GetMask(new string[] { "LadderBottoms" });

		LadderGrabCheck = transform.Find("LadderGrabCheck").GetComponent<BoxCollider2D>();
		LadderDownGrabCheck = transform.Find("LadderDownGrabCheck").GetComponent<BoxCollider2D>();
		LadderBendCheck = transform.Find("LadderBendCheck").GetComponent<BoxCollider2D>();
		LadderFinishClimbingCheck = transform.Find("LadderFinishClimbingCheck").GetComponent<BoxCollider2D>();

		OperationState = StateName.Neutral;
		WalkSpeed = 1.25f;
		WalkSpeedMax = 1.25f;
		JumpSpeed = 5.0f;
	}
예제 #11
0
 protected Node ST_Take(SmartCharacter user, StateName holdingState, Node afterTake)
 {
     return new Sequence(
         user.Node_Require(StateName.RoleActor, StateName.IsStanding, ~StateName.HoldingBall, ~StateName.HoldingWallet, ~StateName.IsIncapacitated),
         this.Node_Require(StateName.RoleTable, holdingState),
         user.Node_GoTo(this.StandPoint.position),
         new SequenceParallel(
             user.Node_HeadLook(this.PropPickup.transform.position),
             user.Node_OrientTowards(this.PropPickup.transform.position)),
         new DecoratorCatch(
             () => { user.Character.StopInteraction(FullBodyBipedEffector.RightHand); user.Character.HeadLookStop(); },
             new Sequence(
                user.Node_StartInteraction(FullBodyBipedEffector.RightHand, this.PropPickup),
                user.Node_WaitForTrigger(FullBodyBipedEffector.RightHand),
                new LeafInvoke(() => user.HoldPropRightHand.Attach(this.PropHolder.Release())),
                user.Node_HeadLookStop())),
         this.Node_Set(~holdingState),
         afterTake,
         user.Node_Set(holdingState),
         user.Node_StartInteraction(FullBodyBipedEffector.RightHand, user.InteractionHoldRight),
         user.Node_WaitForTrigger(FullBodyBipedEffector.RightHand),
         new LeafWait(300));
 }
 public StateBuilder With(StateName name)
 {
     _name = name;
     return this;
 }
	/// <summary>
	/// はしごを昇り切る
	/// </summary>
	/// このとき、指定した collider にはしごの上辺が触れている場合、その高さにちょうど立つように座標をリストアする。
	void FinishClimbingLadder(BoxCollider2D collider)
	{
		ColliderFourSide f = GetColliderFourSide(collider);
		Vector2 pointA = new Vector2(f.LeftX, f.TopY);
		Vector2 pointB = new Vector2(f.RightX, f.BottomY);
		Collider2D[] LadderTopColliders = new Collider2D[1];
		if (Physics2D.OverlapAreaNonAlloc(pointA, pointB, LadderTopColliders, layerMasks.LadderTops) > 0)
		{
			EdgeCollider2D LadderTop = (EdgeCollider2D)LadderTopColliders[0];
			BMController.SetPosY(LadderTop.points[0].y + 16.0f);
		}
		BMController.MoveDistance.y = 0.0f;
		OperationState = StateName.Neutral;
	}
	/// <summary>
	/// はしごを降り切る
	/// </summary>
	/// このとき、指定した collider にはしごの下辺が触れている場合、その高さにちょうど立つように座標をリストアする。
	void LandingFromLadder(BoxCollider2D collider)
	{
		ColliderFourSide f = GetColliderFourSide(collider);
		Vector2 pointA = new Vector2(f.LeftX, f.TopY);
		Vector2 pointB = new Vector2(f.RightX, f.BottomY);
		Collider2D[] LadderBottomColliders = new Collider2D[1];
		if (Physics2D.OverlapAreaNonAlloc(pointA, pointB, LadderBottomColliders, layerMasks.LadderBottoms) > 0)
		{
			EdgeCollider2D LadderBottom = (EdgeCollider2D)LadderBottomColliders[0];
			BMController.SetPosY(LadderBottom.points[0].y + 16.0f);
		}
		OperationState = StateName.Neutral;
	}
	/// <summary>
	/// はしごに掴まる
	/// </summary>
	void GrabLadder(EdgeCollider2D LadderSpine)
	{
		BMController.MoveDistance.y = 0.0f;
		BMController.MoveDistance.x = 0.0f;
		BMController.SetPosX(LadderSpine.points[0].x);

		OperationState = StateName.LadderClimbing;
	}
	/// <summary>
	/// はしごから離れる
	/// </summary>
	void ReleaseLadder()
	{
		OperationState = StateName.Jump;
		Animator.speed = 1.0f;
	}
예제 #17
0
 private void updatePacketSynchHelper(StateName state)
 {
     DataPending[(int)state] = false;
     ElapsedTime[(int)state] = 0;
     UpdatePending[(int)state] = false;
 }
예제 #18
0
파일: Rules.cs 프로젝트: fgeraci/CS195-Core
 private static IList<IHasState> CheckCache(StateName[] states)
 {
     if (cacheStates == null)
         return null;
     IList<IHasState> results;
     if (cacheStates.TryGetValue(states, out results) == false)
         return null;
     return results;
 }
예제 #19
0
    void GameOver()
    {
        players.player1.SendMessage("OnDisableControls", SendMessageOptions.DontRequireReceiver);
        players.player2.SendMessage("OnDisableControls", SendMessageOptions.DontRequireReceiver);

        //set the ball position
        ball.component.enabled = false;
        ball.component.SendMessage("Reset");

        state = StateName.OVER;
    }
예제 #20
0
    void NewGame()
    {
        time.roundStart = Time.time;
        time.roundEnd = Time.time + time.roundDuration;
        scores.player1Score = 0;
        scores.player2Score = 0;

        //set player positions
        players.player1.position = players.player1Position;
        players.player2.position = players.player2Position;

        //enable controls
        players.player1.SendMessage("OnEnableControls", SendMessageOptions.DontRequireReceiver);
        players.player2.SendMessage("OnEnableControls", SendMessageOptions.DontRequireReceiver);

        //set the ball position
        ball.ball.position = ball.ballDropPosition;
        ball.component.enabled = true;

        state = StateName.PLAYING;
    }
예제 #21
0
 ///// <summary>
 ///// Returns a string representation of a single role.
 ///// </summary>
 private string RoleToString(StateName role)
 {
     if (role < 0)
     {
         return "~" + (~role).ToString();
     }
     else
     {
         return role.ToString();
     }
 }
예제 #22
0
 protected Node ST_DropRightHand(SmartCharacter user, StateName holdingState)
 {
     return new Sequence(
         user.Node_Require(StateName.RoleActor, StateName.RightHandOccupied, holdingState, StateName.IsStanding),
         this.Node_Require(StateName.RoleContainer, ~StateName.IsOccupied),
         new LeafInvoke(() => this.transform.position = user.transform.position),
         new LeafInvoke(() => this.Holder.Attach(user.HoldPropRightHand.Release())),
         this.Node_Set(holdingState, StateName.IsOccupied),
         user.Node_Set(~holdingState, ~StateName.RightHandOccupied));
 }
예제 #23
0
 public State(Guid id, StateName name, string alias)
     : base(id)
 {
     Name = name;
     Alias = alias;
 }
예제 #24
0
        // Variables Declaration
        /* **********************************************************************************
         *
         * Function: void TimeoutEventHandler
         * Inputs: PName packet_type, int flags
         * Outputs: None
         * Return Value: None
         * Dependencies: None
         * Description:
         *
         * Handles timeout events generated by the AHRS class - a timeout event occurs if the
         * AHRS class attempts to communicate with the AHRS device and receives no response.
         *
         * *********************************************************************************/
        void TimeoutEventHandler(StateName packet_type, int flags)
        {
            string message;

            message = "Timeout: ";
            message += System.Enum.Format(typeof(StateName), packet_type, "G");
            message += "\r\n";

            AppendStatusText(message, Color.Red, channel);
        }
예제 #25
0
 protected Node ST_PickupLeftHand(SmartCharacter user, StateName holdingState)
 {
     return new Sequence(
         user.Node_Require(StateName.RoleActor, ~StateName.LeftHandOccupied, StateName.IsStanding),
         this.Node_Require(StateName.RoleContainer, holdingState, StateName.IsOccupied),
         user.Node_GoToUpToRadius(Val.V(() => 
             this.ContainedProp.transform.position + 0.15f * user.transform.right), 0.1f),
         user.Behavior.Node_BodyAnimation("pickupleft", true),
         new LeafWait(500),
         new LeafInvoke(() => user.HoldPropLeftHand.Attach(this.Holder.Release())),
         this.Node_Set(~holdingState, ~StateName.IsOccupied),
         user.Node_Set(holdingState, StateName.LeftHandOccupied),
         new LeafWait(500));
 }
예제 #26
0
    public static string PrettyPrint(StateName state, bool value)
    {
        return (value == true) ? state.ToString() : "";

        //switch (state)
        //{
        //    case StateName.RoleActor:       return value ? " Rac" : "";
        //    case StateName.RoleChair:       return value ? " Rch" : "";
        //    case StateName.RoleTable:       return value ? " Rta" : "";
        //    case StateName.RoleCrowd:       return value ? " Rcr" : "";
        //    case StateName.RoleVendorStand: return value ? " Rvs" : "";
        //    case StateName.RoleWaypoint:    return value ? " Rwp" : "";
        //    case StateName.RoleLamp:        return value ? " Rla" : "";
        //    case StateName.RoleContainer:   return value ? " Rla" : "";
        //    case StateName.RoleTelevision:  return value ? " Rtv" : "";
        //    case StateName.RoleAttraction:  return value ? " Rat" : "";
        //    case StateName.HoldingBall:     return value ? " Hba" : "";
        //    case StateName.HoldingWallet:   return value ? " Hwa" : "";
        //    case StateName.IsStanding:      return value ? " Ist" : "";
        //    case StateName.IsIncapacitated: return value ? " Iic" : "";
        //    case StateName.IsDead:          return value ? " Idd" : "";
        //    case StateName.IsOccupied:      return value ? " Ioc" : "";
        //    case StateName.IsTurnedOn:      return value ? " Ito" : "";
        //    default:                        return value ? " Xxx" : "";
        //}
    }
예제 #27
0
 protected Node ST_Drop(SmartCharacter user, StateName holdingState, PropHolder holder)
 {
     return new Sequence(
         user.Node_Require(StateName.RoleActor, holdingState, StateName.IsStanding),
         this.Node_Require(StateName.RoleContainer, ~StateName.IsOccupied),
         new LeafInvoke(() => this.Holder.Attach(holder.Release())),
         this.Node_Set(holdingState, StateName.IsOccupied),
         user.Node_Set(~holdingState));
 }
예제 #28
0
        /* **********************************************************************************
         *
         * Function: void TimeoutEventHandler
         * Inputs: PName packet_type, int flags
         * Outputs: None
         * Return Value: None
         * Dependencies: None
         * Description:
         *
         * Handles timeout events generated by the AHRS class - a timeout event occurs if the
         * AHRS class attempts to communicate with the AHRS device and receives no response.
         *
         * *********************************************************************************/
        void TimeoutEventHandler(StateName packet_type, int flags)
        {
            string message;

            message = "Timeout: ";
            message += System.Enum.Format(typeof(StateName), packet_type, "G");
            message += "\r\n";
        }
	/// <summary>
	/// 通常の操作受付
	/// </summary>
	/// 左右移動, ジャンプ開始, スライディング開始, はしごに掴まる
	void StandardOperation()
	{
        // 十字キー入力状態の取得
        Vector2 Axis = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));
		// ジャンプ開始
		if (Input.GetButtonDown("Jump") && !BMController.IsAir)
		{
			BMController.Jump(JumpSpeed);
			OperationState = StateName.Jump;
		}
		// 左右移動
		if (Axis.x != 0)
		{
			float Direction = Axis.x;
			SpriteRenderer.flipX = Direction < 0;
			BMController.MoveDistance.x = Mathf.Min(WalkSpeedMax, Mathf.Max(-WalkSpeedMax, BMController.MoveDistance.x += WalkSpeed * Direction));
            OperationState = StateName.Walking;
		}
		// 左右キーが入力されていない場合は移動をやめる
		else
		{
			BMController.MoveDistance.x = 0;
            OperationState = StateName.Neutral;
        }
        // 接地していない場合
        if (BMController.IsAir)
		{
            OperationState = StateName.Jump;
			// 上または下が押された場合
			if (Axis.y != 0.0f)
			{
				// はしごに重なっている場合
				EdgeCollider2D LadderSpine = GrabCheck(LadderGrabCheck);
				if (LadderSpine != null)
				{
					GrabLadder(LadderSpine);
				}
			}
		}
		// 接地している場合
		else
		{
			// 上が押された場合
			if (Axis.y == 1.0f)
			{
				// はしごに重なっている場合
				EdgeCollider2D LadderSpine = GrabCheck(LadderGrabCheck);
				if (LadderSpine != null)
				{
                    BMController.SetPosY(transform.position.y + 2.0f);
                    GrabLadder(LadderSpine);
				}
			}
			// 下が押された場合
			else if (Axis.y == -1.0f)
			{
				// 足元にはしごがある場合
				EdgeCollider2D FootLadderSpine = GrabCheck(LadderDownGrabCheck);
				if (FootLadderSpine != null)
				{
					BMController.SetPosY(transform.position.y - 8.0f);
					GrabLadder(FootLadderSpine);
				}
			}
		}
	}
 public CreateState(Guid id, StateName name) : base(id)
 {
     Name = name;
     Alias = name.ToString();
 }
예제 #31
0
파일: Rules.cs 프로젝트: fgeraci/CS195-Core
 private static void StoreCache(
     StateName[] states, 
     IList<IHasState> objs)
 {
     if (cacheStates == null)
         cacheStates = 
             new Dictionary<StateName[], IList<IHasState>>();
     cacheStates[states] = objs;
 }
예제 #32
0
 public virtual void ChangeState(StateName p_state)
 {
     if (onStateChange != null) onStateChange(p_state);
 }
예제 #33
0
 /// <summary>
 /// Subtree for Give. Here holdingState should be the StateName corresponding
 /// to the state for holding the object exchanged, e.g. HoldingWallet, HoldingBall.
 /// beforeGive and afterGive can be used to specify actions to be done both before the give starts
 /// (but after they have met and oriented towards each other) and to be done after the give ends.
 /// </summary>
 protected Node ST_Give(SmartCharacter user, StateName holdingState, Node beforeGive, Node afterGive)
 {
     return new Sequence(
         user.Node_Require(StateName.RoleActor, StateName.IsStanding, holdingState, ~StateName.IsIncapacitated),
         this.Node_Require(StateName.RoleActor, StateName.IsStanding, ~holdingState, ~StateName.IsIncapacitated),
         new SequenceParallel(
             user.Node_GoToUpToRadius(new Val<Vector3>(this.transform.position), 1.0f),
             this.Node_OrientTowards(new Val<Vector3>(user.transform.position)),
         user.Node_OrientTowards(new Val<Vector3>(this.transform.position))),
         beforeGive,
         new SequenceParallel(
             user.Node_StartInteraction(FullBodyBipedEffector.RightHand, this.InteractionGive),
             new Sequence(
                 new LeafWait(1000),
                 this.Node_StartInteraction(FullBodyBipedEffector.RightHand, this.InteractionTake)),
             user.Node_WaitForTrigger(FullBodyBipedEffector.RightHand),
             this.Node_WaitForTrigger(FullBodyBipedEffector.RightHand)),
         new LeafInvoke(() => this.HoldPropRightHand.Attach(user.HoldPropRightHand.Release())),
         user.Node_Set(~holdingState),
         afterGive,
         this.Node_Set(holdingState),
         new SequenceParallel(
             user.Node_StopInteraction(FullBodyBipedEffector.RightHand),
             this.Node_StartInteraction(FullBodyBipedEffector.RightHand, this.InteractionHoldRight)));
 }