コード例 #1
0
        public static ClientResolutionAction ClientResolutionAction_DeSerializeFromStream(Component context, ref IBitStream stream)
        {
            ClientResolutionAction resolutionAction = new ClientResolutionAction();
            sbyte num = -1;

            stream.Serialize(ref num);
            ResolutionActionType resolutionActionType = (ResolutionActionType)num;

            resolutionAction.m_type = (ResolutionActionType)num;
            switch (resolutionActionType)
            {
            case ResolutionActionType.AbilityCast:
                resolutionAction.m_abilityResults =
                    AbilityResultsUtils.DeSerializeClientAbilityResultsFromStream(context, ref stream);
                break;

            case ResolutionActionType.EffectAnimation:
            case ResolutionActionType.EffectPulse:
                resolutionAction.m_effectResults =
                    AbilityResultsUtils.DeSerializeClientEffectResultsFromStream(context, ref stream);
                break;

            case ResolutionActionType.EffectOnMove:
            case ResolutionActionType.BarrierOnMove:
            case ResolutionActionType.PowerupOnMove:
            case ResolutionActionType.GameModeOnMove:
                resolutionAction.m_moveResults =
                    AbilityResultsUtils.DeSerializeClientMovementResultsFromStream(context, ref stream);
                break;
            }

            return(resolutionAction);
        }
コード例 #2
0
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                return(1);
            }
            ClientResolutionAction resolutionAction = obj as ClientResolutionAction;

            if (resolutionAction == null)
            {
                throw new ArgumentException("Object is not a ClientResolutionAction");
            }
            if (ReactsToMovement() != resolutionAction.ReactsToMovement())
            {
                return(ReactsToMovement().CompareTo(resolutionAction.ReactsToMovement()));
            }
            if (!ReactsToMovement() && !resolutionAction.ReactsToMovement())
            {
                return(0);
            }
            float moveCost1 = m_moveResults.m_triggeringPath.moveCost;
            float moveCost2 = resolutionAction.m_moveResults.m_triggeringPath.moveCost;

            if (moveCost1 != (double)moveCost2)
            {
                return(moveCost1.CompareTo(moveCost2));
            }
            bool flag1 = m_moveResults.HasBarrierHitResults();
            bool flag2 = resolutionAction.m_moveResults.HasBarrierHitResults();

            if (flag1 && !flag2)
            {
                return(-1);
            }
            if (!flag1 && flag2)
            {
                return(1);
            }
            bool flag3 = m_moveResults.HasGameModeHitResults();
            bool flag4 = resolutionAction.m_moveResults.HasGameModeHitResults();

            if (flag3 && !flag4)
            {
                return(-1);
            }
            return(!flag3 && flag4 ? 1 : 0);
        }