예제 #1
0
    public override void Init(HeroEntity _entity, ComponentParam _param)
    {
        base.Init(_entity, _param);
        CannonComponentParam cannonParam = param as CannonComponentParam;

        mRotateSpeed = cannonParam.rotateSpeed;
    }
예제 #2
0
    public override void Init(HeroEntity _entity, ComponentParam _param)
    {
        base.Init(_entity, _param);



        SetDestination(entity.position);
    }
 public ComponentParam( ComponentParam _src )
 {
     m_ComponentName = _src.m_ComponentName ;
     m_Effect3DObjectTemplateName = _src.m_Effect3DObjectTemplateName ;
     m_GUI = new GUIParam( _src.m_GUI ) ;
     m_IsFlip = _src.m_IsFlip ;
     m_Component3DObject.Setup( _src.m_Component3DObject ) ;
 }
예제 #4
0
 private static void ParseComponentParam(ref ComponentParam param, SecurityElement element)
 {
     if (param == null || element == null || element.Tag != "Param")
     {
         return;
     }
     if (param.type == typeof(CannonComponent))
     {
         var move = param as CannonComponentParam;
         move.rotateSpeed = element.Attribute("rotateSpeed").ToFloatEx();
     }
     else if (param.type == typeof(PlayerComponent))
     {
         var move = param as PlayerComponentParam;
         move.speed = element.Attribute("speed").ToFloatEx();
     }
 }
    public static bool Parse( /*in*/ XmlNode _ComponentNode ,
							  out ComponentParam _Result )
    {
        _Result = new ComponentParam() ;
        if( null == _ComponentNode )
            return false ;

        if( null != _ComponentNode.Attributes[ "componentName" ] )
            _Result.m_ComponentName = _ComponentNode.Attributes[ "componentName" ].Value ;

        if( null != _ComponentNode.Attributes[ "effect3DObjectTemplateName" ] )
            _Result.m_Effect3DObjectTemplateName = _ComponentNode.Attributes[ "effect3DObjectTemplateName" ].Value ;

        if( null != _ComponentNode.Attributes[ "displayName" ] )
            _Result.GUIDisplayName = _ComponentNode.Attributes[ "displayName" ].Value ;
        if( true == _ComponentNode.HasChildNodes )
        {
            for( int i = 0 ; i < _ComponentNode.ChildNodes.Count ; ++i )
            {
                XmlNode childNode = _ComponentNode.ChildNodes[ i ] ;
                if( "GUIPosition" == childNode.Name )
                {
                    if( null != childNode.Attributes[ "x" ] &&
                        null != childNode.Attributes[ "y" ] &&
                        null != childNode.Attributes[ "width" ] &&
                        null != childNode.Attributes[ "height" ] )
                    {
                        float x = 0.0f ;
                        float y = 0.0f ;
                        float width = 0.0f ;
                        float height = 0.0f ;
                        float.TryParse( childNode.Attributes[ "x" ].Value , out x ) ;
                        float.TryParse( childNode.Attributes[ "y" ].Value , out y ) ;
                        float.TryParse( childNode.Attributes[ "width" ].Value , out width ) ;
                        float.TryParse( childNode.Attributes[ "height" ].Value , out height ) ;
                        _Result.GUIRect = new Rect( x , y , width , height ) ;
                    }
                }
            }
        }
        return ( 0 != _Result.m_ComponentName.Length ) ;
    }
예제 #6
0
 public IActionResult Update(ComponentParam param)
 {
     if (!param.Id.HasValue)
     {
         return(BadRequest());
     }
     if (param.Component.Name != null && param.Component.Name != string.Empty)
     {
         update.Update(param.Id, param.Component);
         return(BadRequest());
     }
     try
     {
         return(NoContent());
     }
     catch (NotFoundComponentException)
     {
         return(NotFound());
     }
 }
예제 #7
0
    private static void ParseComponent(ref HeroParam param, SecurityElement element)
    {
        if (element == null || element.Tag != "Component")
        {
            return;
        }
        ComponentParam component = (ComponentParam)Activator.CreateInstance(Type.GetType(element.Attribute("param")));

        component.type = Type.GetType(element.Attribute("type"));

        param.components.Add(component);

        if (element.Children != null)
        {
            for (int i = 0; i < element.Children.Count; ++i)
            {
                var child = element.Children[i] as SecurityElement;
                if (child.Tag == "Param")
                {
                    ParseComponentParam(ref component, child);
                }
            }
        }
    }
    public UnitComponentData( UnitComponentData _src )
    {
        this.m_Name = _src.m_Name ;
        this.m_HP = new StandardParameter( _src.m_HP ) ;
        this.m_Energy = new StandardParameter( _src.m_Energy ) ;
        this.m_Generation = new StandardParameter( _src.m_Generation ) ;
        this.m_Effect = new StandardParameter( _src.m_Effect ) ;

        this.m_Status = _src.m_Status ;
        this.m_StatusDescription = new StatusDescription( _src.m_StatusDescription ) ;
        this.m_Effect_HP_Curve = new InterpolateTable( _src.m_Effect_HP_Curve ) ;

        this.m_ReloadEnergy = new StandardParameter( _src.m_ReloadEnergy ) ;
        this.m_ReloadGeneration = new StandardParameter( _src.m_ReloadGeneration ) ;
        this.m_WeaponReloadStatus = _src.m_WeaponReloadStatus ;

        this.m_ComponentParam = new ComponentParam( _src.m_ComponentParam ) ;
        this.m_WeaponParam = new WeaponParam( _src.m_WeaponParam ) ;
    }
예제 #9
0
        private async Task NodesPositionedAlgorithmicly(ComponentParam ad)
        {
            using (var cmd = Db.CreateCommand())
            {
                cmd.CommandText = @"select
                                            isnull([CORE],0) as [CORE],isnull([OTHER],0) as [OTHER], isnull([CORNER],0) as [CORNER]
                                        FROM
	                                        (select
		                                        case when
			                                        node_x between p1_x and p2_x
			                                        and
			                                        node_y between p1_y and p2_y then 'CORE'
		                                        when
			                                        (node_x < p25_x and node_y < p25_y)
			                                        or
			                                        (node_x < p25_x and node_y > p75_y)
			                                        or
			                                        (node_x > p75_x and node_y < p25_y)
			                                        or
			                                        (node_x > p75_x and node_y > p75_y) then 'CORNER'
		                                        else
			                                        'OTHER' end as [area]
		                                        , count(distinct node_key) as nn
	                                        from
		                                        ls_node_position np CROSS JOIN
		                                        (select	distinct
			                                        PERCENTILE_CONT(0.9) WITHIN GROUP (ORDER BY node_x) OVER () as p75_x
			                                        , PERCENTILE_CONT(0.9) WITHIN GROUP (ORDER BY node_y) OVER () as p75_y
			                                        , PERCENTILE_CONT(0.1) WITHIN GROUP (ORDER BY node_x) OVER () as p25_x
			                                        , PERCENTILE_CONT(0.1) WITHIN GROUP (ORDER BY node_y) OVER () as p25_y
			                                        , PERCENTILE_CONT(0.4) WITHIN GROUP (ORDER BY node_x) OVER () as p1_x
			                                        , PERCENTILE_CONT(0.4) WITHIN GROUP (ORDER BY node_y) OVER () as p1_y
			                                        , PERCENTILE_CONT(0.6) WITHIN GROUP (ORDER BY node_x) OVER () as p2_x
			                                        , PERCENTILE_CONT(0.6) WITHIN GROUP (ORDER BY node_y) OVER () as p2_y
		                                        FROM
			                                        ls_node_position
		                                        ) a
	                                        GROUP BY
		                                        case when
			                                        node_x between p1_x and p2_x
			                                        and
			                                        node_y between p1_y and p2_y then 'CORE'
		                                        when
			                                        (node_x < p25_x and node_y < p25_y)
			                                        or
			                                        (node_x < p25_x and node_y > p75_y)
			                                        or
			                                        (node_x > p75_x and node_y < p25_y)
			                                        or
			                                        (node_x > p75_x and node_y > p75_y) then 'CORNER'
		                                        else
			                                        'OTHER' end
	                                        ) a
                                        PIVOT(
	                                        max(nn) FOR area in ([CORE],[OTHER],[CORNER])
                                        ) pvt";

                using (var reader = await cmd.ExecuteReaderAsync())
                {
                    while (await reader.ReadAsync() && !Program.StopNow)
                    {
                        int nCore   = (int)reader["CORE"];
                        int nCorner = (int)reader["CORNER"];
                        int nOther  = (int)reader["OTHER"];

                        double cornerShareTotal = (double)nCorner / (double)(nCorner + nCore + nOther);
                        double cornerCoreRatio  = (nCorner == 0 ? 1000 : (double)nCore / (double)nCorner);

                        switch (ad.Algorithm)
                        {
                        case MdsAlgorithm.Random:     // The corner should contain 4% of points. Less than 1% or more than 10% fails the test (arbitrary boundaries)
                            Results.Add(new TestResult
                            {
                                Message = String.Format("Corners share of points is {0} where 0.04 is expected in Random positioning.", cornerShareTotal),
                                Name    = "NodePositionedAlgorithmicly",
                                Success = (cornerShareTotal > 0.01 && cornerShareTotal < 0.1),
                            });
                            break;

                        case MdsAlgorithm.MatlabMds:     // The resulting distribution is circular. The core should contain at least twice as many points.
                            Results.Add(new TestResult
                            {
                                Message = String.Format("Ratio of points in core vs corners is {0}. In circular MDS positioning at least a factor 2 is expected.", nCorner == 0 ? "Infinite" : String.Format("{0}", cornerCoreRatio)),
                                Name    = "NodePositionedAlgorithmicly",
                                Success = (cornerCoreRatio >= 2),
                            });
                            break;
                        }
                    }
                }
            }
        }
예제 #10
0
 public virtual void Init(HeroEntity _entity, ComponentParam _param)
 {
     entity = _entity;
     param  = _param;
 }