Exemplo n.º 1
0
        /// <summary>
        /// 设置选择区域。
        /// 目前只支持IPolygon,后面会支持ClosedTrimesh和IMultiPolygon。
        /// 允许传入null,相当于把region清空,清空之后即使VisibleMask还是1也没有任何高亮区域。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSetRegion_Click(object sender, EventArgs e)
        {
            type = HelperType.PolygonRegion;

            this.label7.Text = "请鼠标点击画Polygon";
            this.btnSetCircleRegion.Enabled = false;
            this.btnSetSectorRegion.Enabled = false;
            this.btnSetRegion.Enabled       = false;
            isDrawing = true;

            axRenderControl1.HighlightHelper.SetRegion(null);  //清空之前的高亮区

            axRenderControl1.InteractMode          = gviInteractMode.gviInteractEdit;
            axRenderControl1.MouseSelectObjectMask = gviMouseSelectObjectMask.gviSelectAll;
            axRenderControl1.MouseSelectMode       = gviMouseSelectMode.gviMouseSelectClick;
            axRenderControl1.RcObjectEditing      += new _IRenderControlEvents_RcObjectEditingEventHandler(g_RcObjectEditing);
            axRenderControl1.RcObjectEditFinish   += new _IRenderControlEvents_RcObjectEditFinishEventHandler(g_RcObjectEditFinish);

            if (rpolygon != null)
            {
                axRenderControl1.ObjectManager.DeleteObject(rpolygon.Guid);
            }

            polygon  = geoFactory.CreateGeometry(gviGeometryType.gviGeometryPolygon, gviVertexAttribute.gviVertexAttributeZ) as IPolygon;
            rpolygon = axRenderControl1.ObjectManager.CreateRenderPolygon(polygon, null, rootId);
            axRenderControl1.ObjectEditor.StartEditRenderGeometry(rpolygon, gviGeoEditType.gviGeoEditCreator);
        }
Exemplo n.º 2
0
 public Helper(StateSystem statesystem, String label, TextSection textsection)
     : base(statesystem, label, textsection)
 {
     m_helpertype = textsection.GetAttribute<HelperType>("helpertype", HelperType.Normal);
     m_name = textsection.GetAttribute<String>("name", null);
     m_id = textsection.GetAttribute<Evaluation.Expression>("id", null);
     m_position = textsection.GetAttribute<Evaluation.Expression>("pos", null);
     m_postype = textsection.GetAttribute<PositionType>("postype", PositionType.P1);
     m_facing = textsection.GetAttribute<Evaluation.Expression>("facing", null);
     m_statenumber = textsection.GetAttribute<Evaluation.Expression>("stateno", null);
     m_keyctrl = textsection.GetAttribute<Evaluation.Expression>("keyctrl", null);
     m_ownpal = textsection.GetAttribute<Evaluation.Expression>("ownpal", null);
     m_supermovetime = textsection.GetAttribute<Evaluation.Expression>("SuperMoveTime", null);
     m_pausemovetime = textsection.GetAttribute<Evaluation.Expression>("PauseMoveTime", null);
     m_xscale = textsection.GetAttribute<Evaluation.Expression>("size.xscale", null);
     m_yscale = textsection.GetAttribute<Evaluation.Expression>("size.yscale", null);
     m_groundback = textsection.GetAttribute<Evaluation.Expression>("size.ground.back", null);
     m_groundfront = textsection.GetAttribute<Evaluation.Expression>("size.ground.front", null);
     m_airback = textsection.GetAttribute<Evaluation.Expression>("size.air.back", null);
     m_airfront = textsection.GetAttribute<Evaluation.Expression>("size.air.front", null);
     m_height = textsection.GetAttribute<Evaluation.Expression>("size.height", null);
     m_projectscaling = textsection.GetAttribute<Evaluation.Expression>("size.proj.doscale", null);
     m_headpos = textsection.GetAttribute<Evaluation.Expression>("size.head.pos", null);
     m_midpos = textsection.GetAttribute<Evaluation.Expression>("size.mid.pos", null);
     m_shadowoffset = textsection.GetAttribute<Evaluation.Expression>("size.shadowoffset", null);
 }
Exemplo n.º 3
0
    //Factory Pattern Method
    void SpawnHelper(HelperType type)
    {
        string typeName = type.ToString();

        GameObject newHelper = (GameObject)Instantiate(Resources.Load(typeName), playerRef.transform.position, Quaternion.identity);

        switch (typeName)
        {
        case "Attacker":
            Attacker newAttacker = newHelper.GetComponent <Attacker>();
            newAttacker.ID        = helperIterator;
            newAttacker.PlayerRef = playerRef;
            currentHelpers.Add(newAttacker);
            break;

        case "Protector":
            Protector newProtector = newHelper.GetComponent <Protector>();
            newProtector.ID        = helperIterator;
            newProtector.PlayerRef = playerRef;
            currentHelpers.Add(newProtector);
            break;

        case "Shooter":
            Shooter newShooter = newHelper.GetComponent <Shooter>();
            newShooter.ID        = helperIterator;
            newShooter.PlayerRef = playerRef;
            currentHelpers.Add(newShooter);
            break;
        }

        helperIterator++;
    }
Exemplo n.º 4
0
 private string Beautify(HelperType value)
 {
     if (HelperTypeMap.ContainsKey(value))
     {
         return(HelperTypeMap[value]);
     }
     return(value.ToString());
 }
Exemplo n.º 5
0
 /// <summary>
 ///     Creates a <see cref="IProjection" /> for the given <see cref="Expression" />.
 /// </summary>
 /// <param name="expression">
 ///     The expression.
 /// </param>
 /// <param name="data">
 ///     The <see cref="QueryHelperData" /> data.
 /// </param>
 /// <param name="type">
 ///     The <see cref="HelperType" /> type.
 /// </param>
 /// <returns>
 ///     The resolved <see cref="IProjection" /> instance.
 /// </returns>
 /// <exception cref="NotSupportedException">
 ///     The <see cref="Expression" /> could not be resolved as it may contain unsupported features or similar.
 /// </exception>
 public static IProjection GetProjection
 (
     LambdaExpression expression,
     QueryHelperData data,
     HelperType type = HelperType.Select
 )
 {
     return(GetProjection(expression.Body, new HelperContext(data, expression.Parameters[0].Name, type)));
 }
Exemplo n.º 6
0
 private Helper(HelperStatic staticData, int order, HelperType type, double baseCost, List <HelperSkill> skills, bool isInGame, Bitmap image, string version)
 {
     _staticData = staticData;
     Order       = order;
     HelperType  = type;
     BaseCost    = baseCost;
     Skills      = skills.AsReadOnly();
     IsInGame    = isInGame;
     Image       = image;
     FileVersion = version;
 }
Exemplo n.º 7
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="HelperContext" /> class.
 /// </summary>
 /// <param name="data">
 ///     The <see cref="QueryHelperData" /> data.
 /// </param>
 /// <param name="rootAlias">
 ///     The root alias.
 /// </param>
 /// <param name="type">
 ///     The <see cref="HelperType" />.
 /// </param>
 public HelperContext
 (
     QueryHelperData data,
     string rootAlias,
     HelperType type
 )
 {
     Data      = data;
     RootAlias = rootAlias;
     Type      = type;
 }
Exemplo n.º 8
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="HelperContext" /> class.
 /// </summary>
 /// <param name="data">
 ///     The <see cref="QueryHelperData" /> data.
 /// </param>
 /// <param name="expression">
 ///     A lambda expression.
 /// </param>
 /// <param name="type">
 ///     The <see cref="HelperType" />.
 /// </param>
 public HelperContext
 (
     QueryHelperData data,
     LambdaExpression expression,
     HelperType type
 )
     : this(data, (string)null, type)
 {
     RootAlias = expression != null && expression.Parameters.Count > 0
         ? expression.Parameters[0].Name
         : null;
 }
Exemplo n.º 9
0
            public void Add(long value)
            {
                if (IsReady)
                {
                    return;
                }

                if (Count > 1)
                {
                    bool  sign;
                    ulong delta;

                    if (value >= oldValue)
                    {
                        sign  = false;
                        delta = (ulong)(value - oldValue);
                    }
                    else
                    {
                        sign  = true;
                        delta = (ulong)(oldValue - value);
                    }

                    int bits = BitUtils.GetBitBounds(delta);
                    map[bits]++;
                    if (bits > maxIndex)
                    {
                        maxIndex = bits;
                    }

                    if (Type > HelperType.Delta)
                    {
                        if (Sign != sign)
                        {
                            Type = HelperType.Delta;
                        }
                        else if (delta != Delta)
                        {
                            Type = HelperType.DeltaMonotone;
                        }
                    }
                }
                else if (Count == 1)
                {
                    SecondAdd(value);
                }

                oldValue = value;
                Count++;
            }
Exemplo n.º 10
0
        public static ILocalisable <string> ToLocalisable(this HelperType helperType)
        {
            switch (helperType)
            {
            case HelperType.Spell: return((LocalisedString)SPELL);

            case HelperType.Melee: return((LocalisedString)MELEE);

            case HelperType.Ranged: return((LocalisedString)RANGE);

            case HelperType.None: return((LocalisedString)NONE);
            }
            return((RawString)helperType.ToString());
        }
Exemplo n.º 11
0
        /// <summary>
        /// 画扇区
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSetSectorRegion_Click(object sender, EventArgs e)
        {
            type = HelperType.SectorRegion;

            this.label7.Text = "请鼠标点击选择观察点";
            this.btnSetCircleRegion.Enabled = false;
            this.btnSetSectorRegion.Enabled = false;
            this.btnSetRegion.Enabled       = false;
            isDrawing = true;

            axRenderControl1.HighlightHelper.SetRegion(null);  //清空之前的高亮区

            axRenderControl1.InteractMode          = gviInteractMode.gviInteractSelect;
            axRenderControl1.MouseSelectObjectMask = gviMouseSelectObjectMask.gviSelectAll;
            axRenderControl1.MouseSelectMode       = gviMouseSelectMode.gviMouseSelectClick;
            axRenderControl1.RcMouseClickSelect   += new _IRenderControlEvents_RcMouseClickSelectEventHandler(g_RcMouseClickSelect);
        }
Exemplo n.º 12
0
        public void OnHelperInfoChanged(object sender, HelperType type)
        {
            switch (type)
            {
            case HelperType.BomjNikolay:
                HelperName.Content = "Бомж Ніколай";
                HelperImage.Source = new BitmapImage(new Uri(@"../Resources/9f14ab62-2be1-4a31-867a-c8ef32fad2e2.png", UriKind.Relative));
                break;

            case HelperType.OdoklasnikVova:
                HelperName.Content = "Однокласник Вова";
                HelperImage.Source = new BitmapImage(new Uri(@"../Resources/358c815b-2a68-4598-b054-9c088627d816.png", UriKind.Relative));
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }
        }
Exemplo n.º 13
0
            public void Prepare()
            {
                if (IsReady)
                {
                    return;
                }

                IsReady = true;

                if (Count <= 1 || Type == HelperType.OneStep)
                {
                    return;
                }

                SizeBits  = (Count - 1) * (/*1 +*/ 64);
                DeltaBits = 64;

                int hasSign = Type == HelperType.DeltaMonotone ? 0 : 1;

                for (int i = 1, c = 0; i <= maxIndex; i++)
                {
                    c += map[i];
                    int size = c * (1 + hasSign + i) + (Count - 1 - c) * (1 + 64);

                    if (size < SizeBits)
                    {
                        SizeBits  = size;
                        DeltaBits = (byte)i;
                    }
                }

                if (DeltaBits < 64)
                {
                    Delta          = (1UL << DeltaBits) - 1; //optimal delta
                    AlwaysUseDelta = DeltaBits == maxIndex;
                }
                else
                {
                    Type = HelperType.Raw;
                }
            }
Exemplo n.º 14
0
        public Helper(int id,
                      int order,
                      HelperType type,
                      double baseCost,
                      List <HelperSkill> skills,
                      bool isInGame,
                      string version,
                      Func <string, ValueTask <Bitmap> > imageGetter = null)
        {
            Id          = id;
            Order       = order;
            HelperType  = type;
            BaseCost    = baseCost;
            Skills      = skills.AsReadOnly();
            IsInGame    = isInGame;
            FileVersion = version;
            ImageGetter = imageGetter;

            Efficency  = Math.Pow(1f - HelperInefficency * Math.Min(Order, HelperInefficencySlowdown), Math.Min(Order, HelperInefficencySlowdown));
            BaseDamage = Efficency * DmgScaleDown * BaseCost;
        }
Exemplo n.º 15
0
 protected HandlebarsBaseHelper(string helperName, HelperType helperType)
 {
     HelperName = helperName;
     HelperType = helperType;
 }
Exemplo n.º 16
0
 public Helper Build(HelperType type, int order, double baseCost, List <HelperSkill> skills, bool isInGame, Bitmap image, string version)
 {
     return(new Helper(this, order, type, baseCost, skills, isInGame, image, version));
 }
Exemplo n.º 17
0
            public void Add(long value)
            {
                if (IsReady)
                    return;

                if (Count > 1)
                {
                    bool sign;
                    ulong delta;

                    if (value >= oldValue)
                    {
                        sign = false;
                        delta = (ulong)(value - oldValue);
                    }
                    else
                    {
                        sign = true;
                        delta = (ulong)(oldValue - value);
                    }

                    int bits = BitUtils.GetBitBounds(delta);
                    map[bits]++;
                    if (bits > maxIndex)
                        maxIndex = bits;

                    if (Type > HelperType.Delta)
                    {
                        if (Sign != sign)
                            Type = HelperType.Delta;
                        else if (delta != Delta)
                            Type = HelperType.DeltaMonotone;
                    }
                }
                else if (Count == 1)
                    SecondAdd(value);

                oldValue = value;
                Count++;
            }
Exemplo n.º 18
0
 /// <summary>
 /// Create road helper
 /// </summary>
 /// <param name="setType">Set type</param>
 /// <param name="setPos">Set position</param>
 public RoadHelper(HelperType setType, Vector3 setPos)
 {
     type = setType;
     pos  = setPos;
 }
Exemplo n.º 19
0
            public void Prepare()
            {
                if (IsReady)
                    return;
                
                IsReady = true;

                if (Count <= 1 || Type == HelperType.OneStep)
                    return;

                SizeBits = (Count - 1) * (/*1 +*/ 64);
                DeltaBits = 64;

                int hasSign = Type == HelperType.DeltaMonotone ? 0 : 1;

                for (int i = 1, c = 0; i <= maxIndex; i++)
                {
                    c += map[i];
                    int size = c * (1 + hasSign + i) + (Count - 1 - c) * (1 + 64);

                    if (size < SizeBits)
                    {
                        SizeBits = size;
                        DeltaBits = (byte)i;
                    }
                }

                if (DeltaBits < 64)
                {
                    Delta = (1UL << DeltaBits) - 1; //optimal delta
                    AlwaysUseDelta = DeltaBits == maxIndex;
                }
                else
                    Type = HelperType.Raw;
            }
 /// <summary>
 /// Create road helper
 /// </summary>
 /// <param name="setType">Set type</param>
 /// <param name="setPos">Set position</param>
 public RoadHelper(HelperType setType, Vector3 setPos)
 {
     type = setType;
     pos = setPos;
 }