Ejemplo n.º 1
0
    public override void Initialize(float speed, float range, float charge, ArrowType type = ArrowType.SplitArrow)
    {
        this.speed = speed;
        this.range = range;
        this.charge = charge;
        this.type = type;

        speedModifier = 1.0f;
        rangeModifier = 1.0f;

        if (converging) {
            shootSound = (AudioClip)Resources.Load ("Audio/shooting");
        } else {

            initialDirection = this.gameObject.transform.forward.normalized;

            numConvergingArrows = 8 + Mathf.RoundToInt(charge * 4);
            convergeAngle = 0;
            convergeIncrement = 360.0f / numConvergingArrows;

            shootSound = (AudioClip)Resources.Load ("Audio/swordSwing2");
        }

        AudioSource source = AudioHelper.PlayClipAt (shootSound, this.gameObject.transform.position);
        source.rolloffMode = AudioRolloffMode.Linear;
        source.maxDistance = 30.0f;

        hitDetails = new int[3];
        gameObject.renderer.material = (Material)Resources.Load("Materials/SplitArrow");
        Destroy (this.gameObject, range/speed);
    }
Ejemplo n.º 2
0
 public override void Initialize(float speed, float range, float charge, ArrowType type = ArrowType.IceArrow)
 {
     speedModifier = 0.9f;
     rangeModifier = 0.8f;
     base.Initialize(speed, range, charge, type);
     gameObject.renderer.material = (Material)Resources.Load("Materials/IceArrow");
 }
Ejemplo n.º 3
0
    public void GUIDisplay(ArrowType currentSelected)
    {
        int index = findInQuiver (currentSelected);
        GUIStyle style = new GUIStyle ();
        style.alignment = TextAnchor.MiddleLeft;
        style.normal.textColor = new Color (1, 0, 0);

        int x = 0;
        int boxWidth = 50;
        for(int i = 1; i < arrows.Length; i++) {
                GUI.Label(new Rect(x + (boxWidth * 0.40f), 2, 30, 20), i.ToString());
                GUI.Box(new Rect(x, 20, boxWidth, 35), "");
                if(i == index) {
                    GUI.Label(new Rect(x + (boxWidth * 0.40f), 33, 30, 20), arrows[i].amount.ToString(), style);
                    smallText.normal.textColor = new Color(1, 0, 0);
                } else {
                    GUI.Label(new Rect(x + (boxWidth * 0.40f), 33, 30, 20), arrows[i].amount.ToString());
                    smallText.normal.textColor = new Color(1, 1, 1);
                }

                GUI.Label(new Rect(x, 20, boxWidth, 40), arrows[i].guiLabel, smallText);

                x += boxWidth;
        }

        if (tutorialMode) {
            GUIStyle bigger = new GUIStyle(GUI.skin.box);
            bigger.fontSize = 18;
            GUI.Box (new Rect (0, 60, 410, 150), arrowTooltips [((int)currentSelected)], bigger);
        }
    }
Ejemplo n.º 4
0
    public override void Initialize(float speed, float range, float charge, ArrowType type = ArrowType.SplitArrow)
    {
        speedModifier = 0.8f;
        rangeModifier = 1.0f;

        this.speed = speedModifier * speed;
        this.range = rangeModifier * range;
        splitRange = range * 0.5f;
        this.charge = charge;
        this.type = type;

        if (split) {
            shootSound = (AudioClip)Resources.Load ("Audio/shooting");;
        } else {
            shootSound = (AudioClip)Resources.Load ("Audio/swordSwing2");
        }
        AudioSource source = AudioHelper.PlayClipAt (shootSound, this.gameObject.transform.position);
        source.rolloffMode = AudioRolloffMode.Linear;
        source.maxDistance = 30.0f;

        hitDetails = new int[3];
        gameObject.renderer.material = (Material)Resources.Load("Materials/SplitArrow");
        Destroy (this.gameObject, (splitRange/speed) / 6);

        splitAngle = -60.0f / (charge + 1);
        splitIncrement = 120 / ((charge + 1) * (numSplits));
    }
Ejemplo n.º 5
0
 public ArrowComponent(GameObject parent)
     : base(parent)
 {
     arrowKey = ArrowType.None;
     keyTimer = 0;
     keyPressed = KeyType.None;
 }
Ejemplo n.º 6
0
 Sprite GetArrowIcon(ArrowType arrowType)
 {
     switch (arrowType) {
         default:
         case ArrowType.Basic:
             return spriteBasicArrow;
         case ArrowType.Bomb:
             return spriteBombArrow;
     }
 }
Ejemplo n.º 7
0
 GameObject GetArrowByType(ArrowType type)
 {
     switch (type) {
         default:
         case ArrowType.Basic:
             return character.arrowPrefab;
         case ArrowType.Bomb:
             return character.bombArrowPrefab;
     }
 }
Ejemplo n.º 8
0
 public Arrow(GameObject go, ArrowType at, double passedTime)
 {
     alreadyValid = false;
     imJump = false;
     if(at != ArrowType.MINE){go.GetComponent<ArrowScript>().setArrowAssociated(this);}
     else{ go.GetComponent<MineScript>().setArrowAssociated(this); }
     goArrow = go;
     arrowType = at;
     time = passedTime;
     posBegining = goArrow.transform.position;
 }
Ejemplo n.º 9
0
 public ArrowButtonStyle(ArrowType ButtonType)
 {
     MyType = ButtonType;
     p[0] = new Point();
     p[1] = new Point();
     p[2] = new Point();
     //p.Add(new Point(10, 10));
     //p.Add(new Point(20, 20));
     //p.Add(new Point(15, 5));
     //BlackLine = RendererSingleton.StyleFactory.ProduceNewLineStyleInfo(System.Drawing.Color.Black, 1);
     //BlackFill = RendererSingleton.StyleFactory.ProduceNewFillStyleInfo(System.Drawing.Color.Black);
 }
Ejemplo n.º 10
0
 public virtual void Initialize(float speed, float range, float charge, ArrowType type = ArrowType.Arrow)
 {
     this.speed = speedModifier * speed;
     this.range = rangeModifier * range;
     this.charge = charge;
     this.type = type;
     hitDetails = new int[3];
     shootSound = (AudioClip)Resources.Load ("Audio/swordSwing");
     AudioSource source = AudioHelper.PlayClipAt (shootSound, this.gameObject.transform.position);
     source.rolloffMode = AudioRolloffMode.Linear;
     source.maxDistance = 50.0f;
     Destroy (this.gameObject, this.range/this.speed);
 }
Ejemplo n.º 11
0
    public override void Initialize(float speed, float range, float charge, ArrowType type = ArrowType.ForceArrow)
    {
        speedModifier = 1.0f;
        rangeModifier = 1.2f;
        base.Initialize(speed, range, charge, type);
        this.gameObject.collider.isTrigger = true;
        gameObject.renderer.material = (Material)Resources.Load("Materials/PiercingArrow");

        pierceEffect = (GameObject)Instantiate (Resources.Load ("Particles/Air Trail Effect"),
                                                this.transform.position - (Vector3.Normalize(this.gameObject.rigidbody.velocity) * 2.0f),
                                                Quaternion.LookRotation(Vector3.Normalize (this.gameObject.rigidbody.velocity)));
        pierceEffect.transform.parent = this.gameObject.transform;
        Destroy (pierceEffect, this.range/this.speed);
    }
Ejemplo n.º 12
0
    public void addArrow(ArrowType arrow, int amount)
    {
        int index = findInQuiver (arrow);

        if (index == -1) {
            index = findEmpty (arrow);
        }

        if (index != -1) {
            arrows [index].type = arrow;
            arrows [index].amount += amount;
            generateGUILabel (index);
        }
    }
Ejemplo n.º 13
0
    public override void initialize(int characterID, GameObject gameManager)
    {
        base.initialize (characterID, gameManager);
        bow.Initialize ();
        bow.instantiateRangeIndicator (this.gameObject);
        setMainPlayer ();

        ready = false;
        quiverReady = false;
        canShoot = false;
        canMove = false;
        canDash = false;
        canSpecialShot = false;
        currentAmmo = ArrowType.Arrow;
        tutorialQuiver ();
    }
Ejemplo n.º 14
0
 public Arrow(EquationContainer parent, ArrowType arrowType, Position equationPosition)
     : base(parent)
 {
     this.arrowType = arrowType;
     this.equationPosition = equationPosition;
     SubLevel++;
     ApplySymbolGap = false;
     ActiveChild = rowContainer1 = new RowContainer(this);
     rowContainer1.FontFactor = SubFontFactor;
     this.childEquations.Add(rowContainer1);
     CreateDecorations();
     if (equationPosition == Position.BottomAndTop)
     {
         rowContainer2 = new RowContainer(this);
         rowContainer2.FontFactor = SubFontFactor;
         childEquations.Add(rowContainer2);
     }
 }
Ejemplo n.º 15
0
    public override void initialize(int characterID, GameObject gameManager)
    {
        base.initialize (characterID, gameManager);
        bow.Initialize ();
        bow.instantiateRangeIndicator (this.gameObject);
        quiver = new Quiver ();
        quiver.Initialize (7, this.gameObject);
        controller = new Controller ();
        controller.Initialize (currentMovementSpeed);
        setMainPlayer ();

        quiver.addArrow (ArrowType.FireArrow, 3);
        quiver.addArrow (ArrowType.IceArrow, 3);
        quiver.addArrow (ArrowType.ForceArrow, 3);
        quiver.addArrow (ArrowType.TreeArrow, 3);
        quiver.addArrow (ArrowType.PiercingArrow, 3);
        quiver.addArrow (ArrowType.SplitArrow, 3);

        currentAmmo = ArrowType.Arrow;
    }
Ejemplo n.º 16
0
		public MenuButton (string label, Menu menu, ArrowType arrow_type) : base ()
		{
			HBox hbox = new HBox ();
			
			this.image = new Image ();
			hbox.PackStart (this.image, false, false, 1);
			image.Show ();

			this.label = new Label (label);
			this.label.Xalign = 0;
			hbox.PackStart (this.label, true, true, 1);
			this.label.Show ();

			this.arrow = new Arrow (arrow_type, ShadowType.None);
			hbox.PackStart (arrow, false, false, 1);
			arrow.Show ();

			Menu = menu;

			this.Add (hbox);
			hbox.Show ();
		}
Ejemplo n.º 17
0
    internal void Select(ArrowType selectedArrow)
    {
        switch (selectedArrow)
        {
        case ArrowType.NORMAL:
            NormalArrowIcon.SetActive(true);
            FireArrowIcon.SetActive(false);
            WindArrowIcon.SetActive(false);
            break;

        case ArrowType.FIRE:
            NormalArrowIcon.SetActive(false);
            FireArrowIcon.SetActive(true);
            WindArrowIcon.SetActive(false);
            break;

        case ArrowType.WIND:
            NormalArrowIcon.SetActive(false);
            FireArrowIcon.SetActive(false);
            WindArrowIcon.SetActive(true);
            break;
        }
    }
Ejemplo n.º 18
0
        private bool CanUseArrow(BasePlayer player, ArrowType type, BaseCombatEntity combatEntity, out Item outItem)
        {
            if (IsPlayerArrow(type) && combatEntity.ToPlayer() == null)
            {
                PrintToChat(player, Lang("Error_NotPlayer", player.UserIDString, type));
                outItem = null;
                return(false);
            }
            var typeConfig = configFile.Arrows[type];

            if (!typeConfig.ArrowPrice.Enabled)
            {
                outItem = null;
                return(true);
            }
            if (player.inventory.FindItemID(typeConfig.ArrowPrice.ItemShortname) == null)
            {
                PrintToChat(player, Lang("Resources_Needed", player.UserIDString, typeConfig.ArrowPrice.ItemAmount,
                                         ItemManager.CreateByPartialName(typeConfig.ArrowPrice.ItemShortname).info.displayName.english) ?? "<color=red>ITEM NOT FOUND</color>");
                ActiveArrows.Remove(player.userID);
                outItem = null;
                return(false);
            }
            var item   = player.inventory.FindItemID(typeConfig.ArrowPrice.ItemShortname);
            var amount = player.inventory.GetAmount(item.info.itemid);

            if (amount >= typeConfig.ArrowPrice.ItemAmount)
            {
                outItem = ItemManager.CreateByName(typeConfig.ArrowPrice.ItemShortname, typeConfig.ArrowPrice.ItemAmount) ?? ItemManager.CreateByName("metal.refined", 30);
                return(true);
            }
            outItem = null;
            var neededAmount = typeConfig.ArrowPrice.ItemAmount - amount;

            PrintToChat(player, Lang("Resources_Needed", player.UserIDString, neededAmount, item.info.displayName.english));
            return(false);
        }
Ejemplo n.º 19
0
        //Handles the DrawShape event
        private void StencilItem_DrawShape(object sender, DrawShapeEventArgs e)
        {
            //Get the stencil item to draw on, and the type of arrow from the key
            StencilItem stencil   = (StencilItem)sender;
            ArrowType   arrowType = (ArrowType)Enum.Parse(typeof(ArrowType), stencil.Key);

            //Draw the arrow using a 100x100 grid
            e.Path.AddLine(0, 30, 60, 30);
            e.Path.AddLine(60, 30, 60, 0);
            e.Path.AddLine(60, 0, 100, 50);
            e.Path.AddLine(100, 50, 60, 100);
            e.Path.AddLine(60, 100, 60, 70);
            e.Path.AddLine(60, 70, 0, 70);

            //Close the figure
            e.Path.CloseFigure();

            //Rotate the path depending on the type of arrow
            Matrix translateMatrix = new Matrix();

            if (arrowType == ArrowType.Right)
            {
                translateMatrix.RotateAt(180, new PointF(50, 50));
            }
            if (arrowType == ArrowType.Up)
            {
                translateMatrix.RotateAt(-90, new PointF(50, 50));
            }
            if (arrowType == ArrowType.Down)
            {
                translateMatrix.RotateAt(90, new PointF(50, 50));
            }

            //Scale the matrix and apply it back to the path
            translateMatrix.Scale(e.Width / 100, e.Height / 100);
            e.Path.Transform(translateMatrix);
        }
Ejemplo n.º 20
0
    public override void Initialize(float speed, float range, float charge, ArrowType type = ArrowType.ForceArrow)
    {
        BoxCollider collider = gameObject.GetComponent<BoxCollider>();
        collider.center = new Vector3 (-0.0002f, 0.0001f, .9f);
        collider.size = new Vector3 (1.0f, 1.0f, 28.0f);
        speedModifier = 1.2f;
        rangeModifier = 1.0f;
        base.Initialize(speed, range, charge, type);
        this.gameObject.collider.isTrigger = true;
        gameObject.renderer.material = (Material)Resources.Load("Materials/ForceArrow");

        this.gameObject.transform.localScale += new Vector3(0.2f, 0.0f, 0.0f);

        forceTime += charge/3.0f;

        forceEffect = (GameObject)Instantiate (Resources.Load ("Particles/Air Rush Effect"),
                                               this.transform.position + (Vector3.Normalize(this.gameObject.rigidbody.velocity) * 2.0f), Quaternion.identity);
        ParticleSystem forceSystem = forceEffect.GetComponent<ParticleSystem> ();
        Vector3 rotationAngles = Quaternion.LookRotation (Vector3.Normalize (this.gameObject.rigidbody.velocity)).eulerAngles;
        rotationAngles.y += 90.0f;
        forceSystem.transform.Rotate(rotationAngles);
        forceSystem.transform.parent = this.gameObject.transform;
        Destroy (forceEffect, this.range/this.speed);
    }
Ejemplo n.º 21
0
        public MenuButton(string label, Menu menu, ArrowType arrow_type) : base()
        {
            var hbox = new HBox();

            Image = new Image();
            hbox.PackStart(Image, false, false, 1);
            Image.Show();

            this.label = new Label(label)
            {
                Xalign = 0
            };
            hbox.PackStart(this.label, true, true, 1);
            this.label.Show();

            arrow = new Arrow(arrow_type, ShadowType.None);
            hbox.PackStart(arrow, false, false, 1);
            arrow.Show();

            Menu = menu;

            this.Add(hbox);
            hbox.Show();
        }
Ejemplo n.º 22
0
 public void initializeRangeIndicator(Quaternion direction, ArrowType arrow, bool arrowAvailable)
 {
     rangeIndicator.useLineIndicator (direction);
     if (arrowAvailable) {
         switch (arrow) {
         case ArrowType.FireArrow:
             rangeIndicator.changeSpeedModifier (0.7f);
             rangeIndicator.changeRangeLimitMultiplier (0.6f);
             rangeIndicator.useAOEIndicator (direction);
             rangeIndicator.changeAOEModifiers (4, 1.0f);
             break;
         case ArrowType.IceArrow:
             rangeIndicator.changeSpeedModifier (0.9f);
             rangeIndicator.changeRangeLimitMultiplier (0.8f);
             rangeIndicator.useAOEIndicator (direction);
             rangeIndicator.changeAOEModifiers (7, 5.0f);
             break;
         case ArrowType.ForceArrow:
             rangeIndicator.changeSpeedModifier (1.2f);
             rangeIndicator.changeRangeLimitMultiplier (1.0f);
             break;
         case ArrowType.PiercingArrow:
             rangeIndicator.changeSpeedModifier (1.0f);
             rangeIndicator.changeRangeLimitMultiplier (1.2f);
             break;
         case ArrowType.SplitArrow:
             rangeIndicator.changeSpeedModifier (0.8f);
             rangeIndicator.changeRangeLimitMultiplier (1.0f);
             rangeIndicator.useSplitIndicator (direction);
             rangeIndicator.changeSplitModifiers (120.0f, 4);
             break;
         case ArrowType.TreeArrow:
             rangeIndicator.changeSpeedModifier (1.5f);
             rangeIndicator.changeRangeLimitMultiplier (0.1f);
             rangeIndicator.useTreeIndicator (direction);
             rangeIndicator.changeTreeModifiers (3, 2.0f, 3.0f);
             break;
         default:
             break;
         }
     }
     indicatorActive = true;
 }
Ejemplo n.º 23
0
 public ArrowImageObject(Calendar owner, Point x1y1, ArrowType type)
     : base(owner, new Rectangle(x1y1, new Size(SIZE, SIZE)), type == ArrowType.Back ? Properties.Resources.prevup : Properties.Resources.nextup)
 {
     m_type = type;
 }
Ejemplo n.º 24
0
 public void UpdateSprite(ArrowType type)
 {
     this.arrowType = type;
     UpdateSprite(arrowType.ToString());
 }
Ejemplo n.º 25
0
    private void PositionArrowIndicator(Vector3 targetPosition, ArrowType arrowType)
    {
        arrowIndicatorPrefab.enabled = true;

        if (targetPosition.z < 0)
        {
            targetPosition *= -1;
        }

        // Make origin the center of the screen instead of bottom-left
        targetPosition -= _screenCenter;

        // Calculate the angle from the center of the screen to the target off-screen
        float angle = Mathf.Atan2(targetPosition.y, targetPosition.x);

        angle -= 90 * Mathf.Deg2Rad;

        float cos = Mathf.Cos(angle);
        float sin = -Mathf.Sin(angle);

        targetPosition = _screenCenter + new Vector3(sin * 150, cos * 150, 0);

        float m = cos / sin;

        Vector3 screenBounds = _screenCenter * 0.97f;

        // Top and bottom
        if (cos > 0)
        {
            targetPosition = new Vector3(screenBounds.y / m, screenBounds.y, 0);
        }
        else
        {
            targetPosition = new Vector3(-screenBounds.y / m, -screenBounds.y, 0);
        }

        // Right and left
        if (targetPosition.x > screenBounds.x)
        {
            targetPosition = new Vector3(screenBounds.x, screenBounds.x * m, 0);
        }
        else if (targetPosition.x < -screenBounds.x)
        {
            targetPosition = new Vector3(-screenBounds.x, -screenBounds.x * m, 0);
        }

        // Move origin back to bottom-left
        targetPosition += _screenCenter;

        Image arrow;

        switch (arrowType)
        {
        case ArrowType.enemy:
            arrow = getArrowIndicator();
            break;

        case ArrowType.waypoint:
            arrow = getObjectiveArrow();
            break;

        default:
            arrow = getArrowIndicator();
            break;
        }

        arrow.rectTransform.rotation         = Quaternion.Euler(0, 0, angle * Mathf.Rad2Deg);
        arrow.rectTransform.anchoredPosition = targetPosition;
    }
Ejemplo n.º 26
0
    public bool arrowInQuiver(ArrowType arrow)
    {
        int index = findInQuiver(arrow);

        return((arrows[index].amount == 0) ? false : true);
    }
Ejemplo n.º 27
0
 public ArrowName(ArrowType type)
 {
     this.type = type;
     this.name = "Arrows/" + type.ToString().ToLower() + "_arrow";
 }
Ejemplo n.º 28
0
        void TypeAndToken(out IToken tok, out Type ty)
        {
            Contract.Ensures(Contract.ValueAtReturn(out tok)!=null); Contract.Ensures(Contract.ValueAtReturn(out ty) != null);
            tok = Token.NoToken;  ty = new BoolType();  /*keep compiler happy*/
            List<Type> gt; List<Type> tupleArgTypes = null;

            switch (la.kind) {
            case 6: {
            Get();
            tok = t;
            break;
            }
            case 7: {
            Get();
            tok = t;  ty = new CharType();
            break;
            }
            case 9: {
            Get();
            tok = t;  ty = new NatType();
            break;
            }
            case 8: {
            Get();
            tok = t;  ty = new IntType();
            break;
            }
            case 10: {
            Get();
            tok = t;  ty = new RealType();
            break;
            }
            case 11: {
            Get();
            tok = t;  ty = new ObjectType();
            break;
            }
            case 13: {
            Get();
            tok = t;  gt = new List<Type>();
            if (la.kind == 52) {
                GenericInstantiation(gt);
            }
            if (gt.Count > 1) {
             SemErr("set type expects only one type argument");
            }
            ty = new SetType(true, gt.Count == 1 ? gt[0] : null);

            break;
            }
            case 14: {
            Get();
            tok = t;  gt = new List<Type>();
            if (la.kind == 52) {
                GenericInstantiation(gt);
            }
            if (gt.Count > 1) {
             SemErr("set type expects only one type argument");
            }
            ty = new SetType(false, gt.Count == 1 ? gt[0] : null);

            break;
            }
            case 15: {
            Get();
            tok = t;  gt = new List<Type>();
            if (la.kind == 52) {
                GenericInstantiation(gt);
            }
            if (gt.Count > 1) {
             SemErr("multiset type expects only one type argument");
            }
            ty = new MultiSetType(gt.Count == 1 ? gt[0] : null);

            break;
            }
            case 16: {
            Get();
            tok = t;  gt = new List<Type>();
            if (la.kind == 52) {
                GenericInstantiation(gt);
            }
            if (gt.Count > 1) {
             SemErr("seq type expects only one type argument");
            }
            ty = new SeqType(gt.Count == 1 ? gt[0] : null);

            break;
            }
            case 12: {
            Get();
            tok = t;  ty = new UserDefinedType(tok, tok.val, null);
            break;
            }
            case 17: {
            Get();
            tok = t;  gt = new List<Type>();
            if (la.kind == 52) {
                GenericInstantiation(gt);
            }
            if (gt.Count == 0) {
             ty = new MapType(true, null, null);
            } else if (gt.Count != 2) {
             SemErr("map type expects two type arguments");
             ty = new MapType(true, gt[0], gt.Count == 1 ? new InferredTypeProxy() : gt[1]);
            } else {
             ty = new MapType(true, gt[0], gt[1]);
            }

            break;
            }
            case 18: {
            Get();
            tok = t;  gt = new List<Type>();
            if (la.kind == 52) {
                GenericInstantiation(gt);
            }
            if (gt.Count == 0) {
             ty = new MapType(false, null, null);
            } else if (gt.Count != 2) {
             SemErr("imap type expects two type arguments");
             ty = new MapType(false, gt[0], gt.Count == 1 ? new InferredTypeProxy() : gt[1]);
            } else {
             ty = new MapType(false, gt[0], gt[1]);
            }

            break;
            }
            case 5: {
            Get();
            tok = t;  gt = null;
            if (la.kind == 52) {
                gt = new List<Type>();
                GenericInstantiation(gt);
            }
            int dims = tok.val.Length == 5 ? 1 : int.Parse(tok.val.Substring(5));
            ty = theBuiltIns.ArrayType(tok, dims, gt, true);

            break;
            }
            case 50: {
            Get();
            tok = t; tupleArgTypes = new List<Type>();
            if (StartOf(3)) {
                Type(out ty);
                tupleArgTypes.Add(ty);
                while (la.kind == 22) {
                    Get();
                    Type(out ty);
                    tupleArgTypes.Add(ty);
                }
            }
            Expect(51);
            if (tupleArgTypes.Count == 1) {
             // just return the type 'ty'
            } else {
             var dims = tupleArgTypes.Count;
             var tmp = theBuiltIns.TupleType(tok, dims, true);  // make sure the tuple type exists
             ty = new UserDefinedType(tok, BuiltIns.TupleTypeName(dims), dims == 0 ? null : tupleArgTypes);
            }

            break;
            }
            case 1: {
            Expression e; tok = t;
            NameSegmentForTypeName(out e);
            tok = t;
            while (la.kind == 27) {
                Get();
                Expect(1);
                tok = t; List<Type> typeArgs = null;
                if (la.kind == 52) {
                    typeArgs = new List<Type>();
                    GenericInstantiation(typeArgs);
                }
                e = new ExprDotName(tok, e, tok.val, typeArgs);
            }
            ty = new UserDefinedType(e.tok, e);
            break;
            }
            default: SynErr(164); break;
            }
            if (la.kind == 30) {
            Type t2;
            Get();
            tok = t;
            Type(out t2);
            if (tupleArgTypes != null) {
             gt = tupleArgTypes;
            } else {
             gt = new List<Type>{ ty };
            }
            ty = new ArrowType(tok, gt, t2);
            theBuiltIns.CreateArrowTypeDecl(gt.Count);

            }
        }
Ejemplo n.º 29
0
 public static Button CreateArrowButton(ArrowType arrow_type, ShadowType shadow_type)
 {
     return(CreateArrowButton(arrow_type, shadow_type, -1, -1));
 }
Ejemplo n.º 30
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Create up/down icon (Adapted from a post by Eddie Velasquez.)
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="size">The size.</param>
        /// <returns></returns>
        /// ------------------------------------------------------------------------------------
        Bitmap GetArrowBitmap(ArrowType type, ArrowSize size)
        {
            int offset;

            switch (size)
            {
            case ArrowSize.Large:
                offset = 0;
                break;

            case ArrowSize.Medium:
                offset = 2;
                break;

            case ArrowSize.Small:
                offset = 3;
                break;

            default:
                offset = 0;
                break;
            }

            Bitmap bmp = new Bitmap(kHalfArrowSize * 2, kHalfArrowSize * 2);

            using (Graphics gfx = Graphics.FromImage(bmp))
            {
                Brush brush = new SolidBrush(Color.FromArgb(215, 230, 255));
                Pen   pen   = new Pen(Color.FromArgb(49, 106, 197));

                gfx.FillRectangle(new SolidBrush(Color.FromKnownColor(KnownColor.ControlLight)), 0, 0, kHalfArrowSize * 2, kHalfArrowSize * 2);

                Point[] points = null;
                if (type == ArrowType.Ascending)
                {
//					Point left = new Point(kHalfArrowSize, 0);
//					Point right = new Point(kHalfArrowSize, 0);
//					for (int i = 0; i < kHalfArrowSize; i++)
//					{
//						left.X -= 1;
//						right.X += 1;
//						gfx.DrawLine(pen, left, right);
//						left.Y += 1;
//						right.Y += 1;
//						gfx.DrawLine(pen, left, right);
//						left.Y += 1;
//						right.Y += 1;
//					}
                    points = new Point[] { new Point(kHalfArrowSize, offset), new Point(kHalfArrowSize * 2 - 1 - offset, kHalfArrowSize * 2 - 1 - offset),
                                           new Point(offset, kHalfArrowSize * 2 - 1 - offset) };
                    gfx.FillPolygon(brush, points);
                    gfx.DrawPolygon(pen, points);
                }
                else if (type == ArrowType.Descending)
                {
                    points = new Point[] { new Point(offset, offset), new Point(kHalfArrowSize * 2 - 1 - offset, offset), new Point(kHalfArrowSize, kHalfArrowSize * 2 - 1 - offset) };
                    gfx.FillPolygon(brush, points);
                    gfx.DrawPolygon(pen, points);
                }
            }

            return(bmp);
        }
Ejemplo n.º 31
0
 /// <summary>
 /// Creates a new instance of the ArrowStyle class.
 /// </summary>
 /// <param name="arrowType">The arrow type.</param>
 /// <param name="isStroked">The arow shape stroke flag.</param>
 /// <param name="isFilled">The arow shape fill flag.</param>
 /// <param name="radiusX">The arrow X axis radius.</param>
 /// <param name="radiusY">The arrow Y axis radius.</param>
 /// <returns>The new instance of the ArrowStyle class.</returns>
 public static ArrowStyle Create(
     ArrowType arrowType = ArrowType.None,
     bool isStroked = true,
     bool isFilled = false,
     double radiusX = 5.0,
     double radiusY = 3.0)
 {
     return new ArrowStyle()
     {
         ArrowType = arrowType,
         IsFilled = isFilled,
         RadiusX = radiusX,
         RadiusY = radiusY
     };
 }
Ejemplo n.º 32
0
        private float DrawHeadBackground(bool isSelected, Graphics graphics, Color color,
            float x, float y, float width, float height, float radius, ArrowType arrowType, bool dashedLine, bool fill)
        {
            float additionalOffset = arrowType != ArrowType.None ? GetArrowSize(height) : 0;
            width += additionalOffset;
            var oldMode = graphics.SmoothingMode;
            graphics.SmoothingMode = SmoothingMode.AntiAlias;

            try
            {
                // shade
                if (fill)
                    using (var shadePath = CreateRoundRectPath(x + 1, y + 1, width, height, radius))
                    {
                        var shadeBrush = isSelected ? Brushes.Black : Brushes.Gray;
                        graphics.FillPath(shadeBrush, shadePath);
                    }

                using (var forePath = CreateRoundRectPath(x, y, width, height, radius))
                {
                    Color fillColor = Lerp(color, Color.White, 0.92F);

                    if (fill)
                        using (var fillBrush = new LinearGradientBrush(new RectangleF(x, y, width, height), fillColor, Lerp(fillColor, Color.White, 0.9F), 90))
                            graphics.FillPath(fillBrush, forePath);
                    else if (isSelected)
                        graphics.FillPath(Brushes.White, forePath);

                    // frame
                    using (var pen = new Pen(Lerp(color, Color.White, 0.83F)))
                    {
                        if (dashedLine)
                            pen.DashPattern = dashPattern;

                        graphics.DrawPath(pen, forePath);
                    }

                    // arrow if the head is the current branch
                    if (arrowType != ArrowType.None)
                        DrawArrow(graphics, x, y, height, color, arrowType == ArrowType.Filled);
                }
            }
            finally
            {
                graphics.SmoothingMode = oldMode;
            }

            return additionalOffset;
        }
Ejemplo n.º 33
0
 public void IceArrowClicked()
 {
     selectedArrow = ArrowType.IceArrow;
 }
Ejemplo n.º 34
0
 public override void addAmmo(ArrowType type)
 {
     quiver.addArrow (type, 1);
 }
Ejemplo n.º 35
0
        public void ChangeSprite(UIAttributeType type, ArrowType arrow, ref int index)
        {
            int sign = (int)arrow;

            //if (sign == 0) { Debug.Log("Arrow Type is 0.. Updating"); }

            switch (type)
            {
            case UIAttributeType.None:
                //Debug.Log("Wrong Type");
                break;

            case UIAttributeType.Hair:
                ClampInt(ref HairStyleIndex, Collection.Hairstyles.Count, sign, out index);

                PreviewManager.SetHair(Collection.Hairstyles[HairStyleIndex]);
                CurrentCharacterInfo.SpriteSets[CharacterPart.Hair] = Collection.Hairstyles[HairStyleIndex];
                break;

            case UIAttributeType.Colour:
                ClampInt(ref HairColorIndex, System.Enum.GetValues(typeof(HairColor)).Length, sign, out index);
                Collection.hairColor = (HairColor)HairColorIndex;

                PreviewManager.SetHair(Collection.Hairstyles[HairStyleIndex]);
                CurrentCharacterInfo.SpriteSets[CharacterPart.Hair] = Collection.Hairstyles[HairStyleIndex];
                break;

            case UIAttributeType.Face:
                ClampInt(ref FaceIndex, Collection.SpriteSets[SpriteSetCollection.GeneralCharacterPart.Face].Count, sign, out index);

                //PreviewManager.SetHair(Collection.Hairstyles[HairStyleIndex]);
                CurrentCharacterInfo.SpriteSets[CharacterPart.Face] = Collection.SpriteSets[SpriteSetCollection.GeneralCharacterPart.Face][0];
                break;

            case UIAttributeType.Facial:

                break;

            case UIAttributeType.Top:
                Collection.clothing = SpriteSetCollection.CharacterClothing.Top;
                ClampInt(ref ShirtIndex, Collection.Clothes.Count, sign, out index);

                PreviewManager.SetShirt(Collection.Clothes[ShirtIndex]);
                CurrentCharacterInfo.SpriteSets[CharacterPart.Top] = Collection.Clothes[ShirtIndex];
                break;

            case UIAttributeType.Skin:
                ClampInt(ref BodyToneIndex, 5, sign, out index);

                PreviewManager.SetBody(Collection.SpriteSets[SpriteSetCollection.GeneralCharacterPart.Body][BodyToneIndex]);
                PreviewManager.SetHead(Collection.SpriteSets[SpriteSetCollection.GeneralCharacterPart.Head][BodyToneIndex]);
                PreviewManager.SetHands(Collection.SpriteSets[SpriteSetCollection.GeneralCharacterPart.Hands][BodyToneIndex]);

                CurrentCharacterInfo.SpriteSets[CharacterPart.Body]  = Collection.SpriteSets[SpriteSetCollection.GeneralCharacterPart.Body][BodyToneIndex];
                CurrentCharacterInfo.SpriteSets[CharacterPart.Head]  = Collection.SpriteSets[SpriteSetCollection.GeneralCharacterPart.Head][BodyToneIndex];
                CurrentCharacterInfo.SpriteSets[CharacterPart.Hands] = Collection.SpriteSets[SpriteSetCollection.GeneralCharacterPart.Hands][BodyToneIndex];
                break;

            case UIAttributeType.Bottom:
                Collection.clothing = SpriteSetCollection.CharacterClothing.Bottom;
                ClampInt(ref PantsIndex, Collection.Clothes.Count, sign, out index);

                PreviewManager.SetPants(Collection.Clothes[PantsIndex]);
                CurrentCharacterInfo.SpriteSets[CharacterPart.Bottom] = Collection.Clothes[PantsIndex];
                break;

            case UIAttributeType.Other:
                break;
            }
        }
Ejemplo n.º 36
0
    private Arrow getRandomArrowType(GameObject arrowThing)
    {
        Arrow     arrowComponent = null;
        ArrowType type           = ArrowType.Arrow;
        bool      validResult    = false;
        int       numberOfTries  = 0;

        do
        {
            int value = Random.Range(0, 100);
            if (value > 85)
            {
                type = ArrowType.FireArrow;
            }
            else if (value > 65)
            {
                type = ArrowType.SplitArrow;
            }
            else if (value > 50)
            {
                type = ArrowType.IceArrow;
            }
            else if (value > 35)
            {
                type = ArrowType.ForceArrow;
            }
            else if (value > 20)
            {
                type = ArrowType.PiercingArrow;
            }
            else
            {
                type = ArrowType.TreeArrow;
            }

            if (quiver.pullArrow(type))
            {
                switch (type)
                {
                case ArrowType.FireArrow:
                    arrowComponent = arrowThing.AddComponent <FireArrow> ();
                    break;

                case ArrowType.IceArrow:
                    arrowComponent = arrowThing.AddComponent <IceArrow> ();
                    break;

                case ArrowType.ForceArrow:
                    arrowComponent = arrowThing.AddComponent <ForceArrow> ();
                    break;

                case ArrowType.SplitArrow:
                    arrowComponent = arrowThing.AddComponent <SplitArrow> ();
                    break;

                case ArrowType.PiercingArrow:
                    arrowComponent = arrowThing.AddComponent <PiercingArrow> ();
                    break;

                case ArrowType.TreeArrow:
                    arrowComponent = arrowThing.AddComponent <TreeArrow> ();
                    break;

                default:
                    arrowComponent = arrowThing.AddComponent <Arrow>();
                    break;
                }
                validResult = true;
            }
            numberOfTries++;
        } while (!validResult && numberOfTries < 3);

        if (!arrowComponent)
        {
            arrowComponent = arrowThing.AddComponent <Arrow>();
        }
        return(arrowComponent);
    }
Ejemplo n.º 37
0
            public void SetArrowCell(Color32[] pixels, int row, int column, int rowsCount, int columnsCount, ArrowType arrow)
            {
                int x      = Margin + CellSize * column + 1;
                int y      = Margin + CellSize * row + 1;
                int width  = CellSize * columnsCount - 2;
                int height = (CellSize * rowsCount - 2) / 2;
                int ox     = width / 4;
                int w      = width - ox * 2;

                if (arrow == ArrowType.Up)
                {
                    SetUpTriangle(pixels, x, y, width, height);
                    SetRect(pixels, x + ox, y + height, w, height, red, red);
                }
                else
                {
                    SetRect(pixels, x + ox, y, w, height, red, red);
                    SetDownTriangle(pixels, x, y + height, width, height);
                }
            }
Ejemplo n.º 38
0
    private void PositionArrowIndicator(Vector3 targetPosition, ArrowType arrowType)
    {
        arrowIndicatorPrefab.enabled = true;

        if (targetPosition.z < 0)
        {
            targetPosition *= -1;
        }

        // Make origin the center of the screen instead of bottom-left
        targetPosition -= screenCenter;

        // Calculate the angle from the center of the screen to the target off-screen
        float angle = Mathf.Atan2(targetPosition.y, targetPosition.x);
        angle -= 90 * Mathf.Deg2Rad;

        float cos = Mathf.Cos(angle);
        float sin = -Mathf.Sin(angle);

        targetPosition = screenCenter + new Vector3(sin * 150, cos * 150, 0);

        float m = cos / sin;

        Vector3 screenBounds = screenCenter * 0.97f;

        // Top and bottom
        if (cos > 0)
        {
            targetPosition = new Vector3(screenBounds.y / m, screenBounds.y, 0);
        }
        else
        {
            targetPosition = new Vector3(-screenBounds.y / m, -screenBounds.y, 0);
        }

        // Right and left
        if (targetPosition.x > screenBounds.x)
        {
            targetPosition = new Vector3(screenBounds.x, screenBounds.x * m, 0);
        }
        else if (targetPosition.x < -screenBounds.x)
        {
            targetPosition = new Vector3(-screenBounds.x, -screenBounds.x * m, 0);
        }

        // Move origin back to bottom-left
        targetPosition += screenCenter;

        Image arrow;
        switch (arrowType)
        {
            case ArrowType.enemy:
                arrow = getArrowIndicator();
                break;
            case ArrowType.waypoint:
                arrow = getObjectiveArrow();
                break;
            default:
                arrow = getArrowIndicator();
                break;
        }
        
        arrow.rectTransform.rotation = Quaternion.Euler(0, 0, angle * Mathf.Rad2Deg);
        arrow.rectTransform.anchoredPosition = targetPosition;
    }
Ejemplo n.º 39
0
        /// <summary>
        /// Renders a single pager arrow inside a bounding box.
        /// </summary>
        protected virtual void RenderPagerArrow(Cairo.Context context, Gdk.Rectangle bounds, ArrowType direction)
        {
            switch (direction)
            {
            case ArrowType.Up:
                context.MoveTo(bounds.X + bounds.Width / 2.0, bounds.Y);
                context.LineTo(bounds.X, bounds.Y + bounds.Height);
                context.LineTo(bounds.X + bounds.Width, bounds.Y + bounds.Height);
                context.ClosePath();
                break;

            case ArrowType.Down:
                context.MoveTo(bounds.X + bounds.Width / 2.0, bounds.Y + bounds.Height);
                context.LineTo(bounds.X, bounds.Y);
                context.LineTo(bounds.X + bounds.Width, bounds.Y);
                context.ClosePath();
                break;

            case ArrowType.Left:
                context.MoveTo(bounds.X, bounds.Y + bounds.Height / 2.0);
                context.LineTo(bounds.X + bounds.Width, bounds.Y);
                context.LineTo(bounds.X + bounds.Width, bounds.Y + bounds.Height);
                context.ClosePath();
                break;

            case ArrowType.Right:
                context.MoveTo(bounds.X + bounds.Width, bounds.Y + bounds.Height / 2.0);
                context.LineTo(bounds.X, bounds.Y);
                context.LineTo(bounds.X, bounds.Y + bounds.Height);
                context.ClosePath();
                break;

            default:
                return;
            }

            context.SetSourceColor(PagerTriangleColor);
            context.Fill();
        }
Ejemplo n.º 40
0
 private static Field CreateField(ArrowType type)
 {
     return(new Field(type.Name, type, nullable: false));
 }
Ejemplo n.º 41
0
 public void AddHintArrow(Transform target, ArrowType type = ArrowType.DEFAULT)
 {
     _arrowHintDic[target.GetInstanceID()] = new HintArrowTarget(target, GetTemplateObj(type));
 }
Ejemplo n.º 42
0
        /// <summary>
        /// Конвертирует описатель типа стрелки в DOT
        /// </summary>
        /// <param name="arrow"></param>
        /// <returns></returns>
        public static string GetSingleTypeString(ArrowType arrow)
        {
            var sb = new StringBuilder();

            if (0 != (arrow & ArrowType.SideAble))
            {
                if (arrow.HasFlag(ArrowType.Left))
                {
                    sb.Append('l');
                }
                else if (arrow.HasFlag(ArrowType.Right))
                {
                    sb.Append('r');
                }
            }
            if (0 != (arrow & ArrowType.EmptyAble))
            {
                if (arrow.HasFlag(ArrowType.Empty))
                {
                    sb.Append('o');
                }
            }
            if (arrow.HasFlag(ArrowType.Inv))
            {
                sb.Append("inv");
            }
            else if (arrow.HasFlag(ArrowType.Dot))
            {
                sb.Append("dot");
            }
            else if (arrow.HasFlag(ArrowType.Tee))
            {
                sb.Append("tee");
            }
            else if (arrow.HasFlag(ArrowType.Vee))
            {
                sb.Append("vee");
            }
            else if (arrow.HasFlag(ArrowType.Diamond))
            {
                sb.Append("diamond");
            }
            else if (arrow.HasFlag(ArrowType.Curve))
            {
                sb.Append("curve");
            }
            else if (arrow.HasFlag(ArrowType.Box))
            {
                sb.Append("box");
            }
            else if (arrow.HasFlag(ArrowType.Normal))
            {
                sb.Append("normal");
            }
            else if (arrow.HasFlag(ArrowType.Empty))
            {
                sb.Append("empty");
            }
            else if (arrow.HasFlag(ArrowType.None))
            {
                sb.Append("none");
            }
            return(sb.ToString());
        }
Ejemplo n.º 43
0
 public void PoisonArrowClicked()
 {
     selectedArrow = ArrowType.PoisonArrow;
 }
Ejemplo n.º 44
0
 private void generateGUILabel(ArrowType type)
 {
     displayText = "+2 All SPECIAL Arrows";
 }
Ejemplo n.º 45
0
 public override void addAmmo(ArrowType type)
 {
     quiver.addArrow(type, 1);
 }
Ejemplo n.º 46
0
        /// <summary>
        /// Draws an arrow in the specified rectangle with the specified direction. Ratio is used on recursive calls
        /// withing this function to adjust the sizing of bidirectional arrows
        /// </summary>
        public static void DrawArrow(this Graphics graphics, Rectangle area, ArrowType arrowType, double ratio = 1.0 / 3.0)
        {
            if (arrowType == ArrowType.Bidi)
            {
                var halfSize = new Size(area.Width / 2, area.Height);
                graphics.DrawArrow(new Rectangle(area.Location, halfSize), ArrowType.Left, 2 * ratio);
                graphics.DrawArrow(new Rectangle(new Point(area.Center().X, area.Location.Y), halfSize), ArrowType.Right, 2 * ratio);
                return;
            }

            var oldMode = graphics.SmoothingMode;
            graphics.SmoothingMode = SmoothingMode.AntiAlias;
            float bodyHeight = area.Height / 3;
            float headWidth = (area.Width * ratio).Rounded();
            float bodyWidth = area.Width - headWidth;

            PointF[] points =
            {
                new PointF(area.Left, area.Top + bodyHeight),
                new PointF(area.Left + bodyWidth, area.Top + bodyHeight),
                new PointF(area.Left + bodyWidth, area.Top),
                new PointF(area.Right, area.Top + (area.Height / 2)),
                new PointF(area.Left + bodyWidth, area.Bottom),
                new PointF(area.Left + bodyWidth, area.Bottom - bodyHeight),
                new PointF(area.Left, area.Bottom - bodyHeight),
            };

            if (arrowType == ArrowType.Left)
            {
                PointF center = area.Center();
                for (int i = 0; i < points.Length; i++)
                    points[i].X += (2 * (center.X - points[i].X));
            }

            using (GraphicsPath path = new GraphicsPath())
            {
                path.AddPolygon(points);
                graphics.FillPath(Brushes.Black, path);
                graphics.DrawPath(crossPen, path);
            }

            graphics.SmoothingMode = oldMode;
        }
Ejemplo n.º 47
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
            int version = reader.ReadInt();

            switch ( version )
            {
                    /*	case 2:
                    {
                        DefaultMaxLevel = reader.ReadInt();
                        MaxLevelsCap = reader.ReadInt();
                        EnableExpCap = reader.ReadBool();
                        DisplayExpProp = reader.ReadBool();
                        PointsPerLevel = reader.ReadInt();
                        DoubleArtifactCost = reader.ReadBool();
                        BlacksmithOnly = reader.ReadBool();
                        BlacksmithSkillRequired = reader.ReadDouble();
                        RewardBlacksmith = reader.ReadBool();
                        BlacksmithRewardAmt = reader.ReadInt();
                        m_Experience = reader.ReadInt();
                        m_Level = reader.ReadInt();
                        m_Points = reader.ReadInt();
                        m_MaxLevel = reader.ReadInt();
                        goto case 1;
                    }*/
                case 1:
                    {
                        m_Serial = reader.ReadInt();
                        m_Ranged = reader.ReadItem() as BaseRanged;
                        goto case 0;
                    }
                case 0:
                    {
                        m_HasBowString = reader.ReadBool();
                        m_Strength = ( StringStrength )reader.ReadEncodedInt();
                        m_PullWeight = ( PoundsPerPull )reader.ReadEncodedInt();
                        m_ArrowType = ( ArrowType )reader.ReadEncodedInt();
                        m_BoltType = ( BoltType )reader.ReadEncodedInt();
                        break;
                    }
            }
        }
Ejemplo n.º 48
0
        void OnGUI()
        {
            // Dragging events
            if (Event.current.type == EventType.mouseDrag)
            {
                if (leftArrowRect.Contains(Event.current.mousePosition) ||
                    rightArrowRect.Contains(Event.current.mousePosition))
                {
                    if (!dragging)
                    {
                        dragging = true;
                        startPos = currentPos;
                        if (leftArrowRect.Contains(Event.current.mousePosition))
                        {
                            arrowDragged = ArrowType.Left;
                        }
                        else
                        {
                            arrowDragged = ArrowType.Right;
                        }
                    }
                }
                currentPos = Event.current.mousePosition;
            }

            if (Event.current.type == EventType.mouseUp)
            {
                dragging     = false;
                arrowDragged = ArrowType.None;
            }

            if (dragging)
            {
                OnBeingDragged();
            }
            scrollPosition = GUILayout.BeginScrollView(scrollPosition);

            GUI.DrawTexture(imageBackgroundRect, backgroundPreviewTex);

            GUI.DrawTexture(leftArrowRect, leftArrowTex);
            GUI.DrawTexture(rightArrowRect, rightArrowTex);

            GUILayout.EndScrollView();

            // Default arrow positions
            if (GUILayout.Button(TC.get("Behaviour.Normal")))
            {
                OnDefaultClicked();
            }



            GUILayout.BeginHorizontal();
            GUILayout.Box(TC.get("Book.Previous"), GUILayout.Width(0.5f * backgroundPreviewTex.width));
            GUILayout.Box(TC.get("Book.Next"), GUILayout.Width(0.5f * backgroundPreviewTex.width));
            GUILayout.EndHorizontal();



            GUILayout.BeginHorizontal();

            GUILayout.Box("X", GUILayout.Width(0.15f * backgroundPreviewTex.width));
            x_prev = EditorGUILayout.IntField((int)bookRef.getPreviousPagePosition().x,
                                              GUILayout.Width(0.35f * backgroundPreviewTex.width));

            GUILayout.Box("X", GUILayout.Width(0.15f * backgroundPreviewTex.width));
            x_next = EditorGUILayout.IntField((int)bookRef.getNextPagePosition().x,
                                              GUILayout.Width(0.35f * backgroundPreviewTex.width));

            GUILayout.EndHorizontal();



            GUILayout.BeginHorizontal();

            GUILayout.Box("Y", GUILayout.Width(0.15f * backgroundPreviewTex.width));
            y_prev = EditorGUILayout.IntField((int)bookRef.getPreviousPagePosition().y,
                                              GUILayout.Width(0.35f * backgroundPreviewTex.width));
            GUILayout.Box("Y", GUILayout.Width(0.15f * backgroundPreviewTex.width));
            y_next = EditorGUILayout.IntField((int)bookRef.getNextPagePosition().y,
                                              GUILayout.Width(0.35f * backgroundPreviewTex.width));

            GUILayout.EndHorizontal();

            bookRef.setPreviousPagePosition(new Vector2(x_prev, y_prev));
            bookRef.setNextPagePosition(new Vector2(x_next, y_next));
            CalculateArrowsPosition();

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("End"))
            {
                reference.OnDialogOk("Applied");
                this.Close();
            }
            GUILayout.EndHorizontal();
        }
Ejemplo n.º 49
0
 /// <summary>
 /// Добавление дублируемого образца стрел
 /// </summary>
 /// <param name="type">Тип стрелы</param>
 /// <param name="arrowTemplate">Образец</param>
 public void AddArrowTemplate(ArrowType type, CopyableGameObject arrowTemplate)
 {
     _arrowTemplates.Add(type, arrowTemplate);
 }
Ejemplo n.º 50
0
 protected override void OnMouseUp(MouseEventArgs e)
 {
     this.arrowType = ArrowType.none;
 }
Ejemplo n.º 51
0
        private float DrawRef(DrawRefArgs drawRefArgs, float offset, string name, Color headColor, ArrowType arrowType, bool dashedLine = false, bool fill = false)
        {
            var textColor = fill ? headColor : Lerp(headColor, Color.White, 0.5f);

            if (IsCardLayout())
            {
                using (Brush textBrush = new SolidBrush(textColor))
                {
                    string headName = name;
                    offset += drawRefArgs.Graphics.MeasureString(headName, drawRefArgs.RefsFont).Width + 6;
                    var location = new PointF(drawRefArgs.CellBounds.Right - offset, drawRefArgs.CellBounds.Top + 4);
                    var size = new SizeF(drawRefArgs.Graphics.MeasureString(headName, drawRefArgs.RefsFont).Width,
                                     drawRefArgs.Graphics.MeasureString(headName, drawRefArgs.RefsFont).Height);
                    if (fill)
                        drawRefArgs.Graphics.FillRectangle(SystemBrushes.Info, location.X - 1,
                                             location.Y - 1, size.Width + 3, size.Height + 2);

                    drawRefArgs.Graphics.DrawRectangle(SystemPens.InfoText, location.X - 1,
                                         location.Y - 1, size.Width + 3, size.Height + 2);
                    drawRefArgs.Graphics.DrawString(headName, drawRefArgs.RefsFont, textBrush, location);
                }
            }
            else
            {
                string headName = IsFilledBranchesLayout()
                               ? name
                               : string.Concat("[", name, "] ");

                var headBounds = AdjustCellBounds(drawRefArgs.CellBounds, offset);
                SizeF textSize = drawRefArgs.Graphics.MeasureString(headName, drawRefArgs.RefsFont);

                offset += textSize.Width;

                if (IsFilledBranchesLayout())
                {
                    offset += 9;

                    float extraOffset = DrawHeadBackground(drawRefArgs.IsRowSelected, drawRefArgs.Graphics,
                                                           headColor, headBounds.X,
                                                           headBounds.Y,
                                                           RoundToEven(textSize.Width + 3),
                                                           RoundToEven(textSize.Height), 3,
                                                           arrowType, dashedLine, fill);

                    offset += extraOffset;
                    headBounds.Offset((int)(extraOffset + 1), 0);
                }

                DrawColumnText(drawRefArgs.Graphics, headName, drawRefArgs.RefsFont, textColor, headBounds);
            }

            return offset;
        }
Ejemplo n.º 52
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);
            if (arrowType != ArrowType.move && arrowType != ArrowType.none)
            {
                reSize(e);
                return;
            }
            //调整鼠标形状
            if (Math.Abs(e.X - cropArea.Left) <= radius && Math.Abs(e.Y - cropArea.Top) <= radius)
            {
                this.Cursor = Cursors.SizeNWSE;//左上
            }
            else if (Math.Abs(e.X - cropArea.Right) <= radius && Math.Abs(e.Y - cropArea.Top) <= radius)
            {
                this.Cursor = Cursors.SizeNESW;//右上
            }
            else if (Math.Abs(e.X - cropArea.Left) <= radius && Math.Abs(e.Y - cropArea.Bottom) <= radius)
            {
                this.Cursor = Cursors.SizeNESW;//左下
            }
            else if (Math.Abs(e.X - cropArea.Right) <= radius && Math.Abs(e.Y - cropArea.Bottom) <= radius)
            {
                this.Cursor = Cursors.SizeNWSE;//右下
            }
            else if (cropArea.Contains(e.Location))
            {
                this.Cursor = Cursors.SizeAll;//中间移动
            }
            else
            {
                this.Cursor = Cursors.Default;
            }

            if (e.Button == MouseButtons.Left || e.Button == MouseButtons.Right)
            {
                Point tempScrPoint  = this.PointToScreen(e.Location);
                Point tempLastPoint = this.lastPoint;

                if (Math.Abs(e.X - cropArea.Left) <= radius && Math.Abs(e.Y - cropArea.Top) <= radius)
                {
                    this.arrowType = ArrowType.leftUp;//左上
                }
                else if (Math.Abs(e.X - cropArea.Right) <= radius && Math.Abs(e.Y - cropArea.Top) <= radius)
                {
                    this.arrowType = ArrowType.rightUp;//右上
                }
                else if (Math.Abs(e.X - cropArea.Left) <= radius && Math.Abs(e.Y - cropArea.Bottom) <= radius)
                {
                    this.arrowType = ArrowType.leftDown;//左下
                }
                else if (Math.Abs(e.X - cropArea.Right) <= radius && Math.Abs(e.Y - cropArea.Bottom) <= radius)
                {
                    this.arrowType = ArrowType.rightDown;//右下
                }
                else if (cropArea.Contains(e.Location))
                {
                    this.arrowType = ArrowType.move;//中间移动
                }
                else
                {
                    this.arrowType = ArrowType.none;
                }

                tempLastPoint.Offset(tempScrPoint.X - this.screenPoint.X, tempScrPoint.Y - this.screenPoint.Y);

                if (arrowType == ArrowType.move)
                {
                    this.Location = tempLastPoint;
                    Refresh();
                    this.Parent.Refresh();
                }
                else
                {
                    reSize(e);
                }
            }
        }
Ejemplo n.º 53
0
 /// <summary>
 /// Creates a new instance of the ArrowStyle class.
 /// </summary>
 /// <param name="name">The arrow style name.</param>
 /// <param name="source">The BaseStyle source object.</param>
 /// <param name="arrowType">The arrow type.</param>
 /// <param name="isStroked">The arow shape stroke flag.</param>
 /// <param name="isFilled">The arow shape fill flag.</param>
 /// <param name="radiusX">The arrow X axis radius.</param>
 /// <param name="radiusY">The arrow Y axis radius.</param>
 /// <returns>The new instance of the ArrowStyle class.</returns>
 public static ArrowStyle Create(
     string name,
     BaseStyle source,
     ArrowType arrowType = ArrowType.None,
     bool isStroked = true,
     bool isFilled = false,
     double radiusX = 5.0,
     double radiusY = 5.0)
 {
     return new ArrowStyle(source)
     {
         Name = name,
         ArrowType = arrowType,
         IsStroked = isStroked,
         IsFilled = isFilled,
         RadiusX = radiusX,
         RadiusY = radiusY
     };
 }
Ejemplo n.º 54
0
 public virtual void addAmmo(ArrowType type)
 {
 }
Ejemplo n.º 55
0
 public ActiveArrow(ArrowType type)
 {
     Uses      = 0;
     ArrowType = type;
 }
Ejemplo n.º 56
0
        /// <summary>
        /// Draws an arrow on a bitmap.
        /// </summary>
        /// <param name="type">Type of arrow to </param>
        /// <returns></returns>
        private static Bitmap GetArrowBitmap(ArrowType type)
        {
            Bitmap bmp = new Bitmap(8, 8);
            Graphics gfx = Graphics.FromImage(bmp);

            Pen lightPen = SystemPens.ControlLightLight;
            Pen shadowPen = SystemPens.ControlDark;

            gfx.FillRectangle(Brushes.Magenta, 0, 0, 8, 8);

            if (type == ArrowType.Ascending)
            {
                gfx.DrawLine(lightPen, 0, 7, 7, 7);
                gfx.DrawLine(lightPen, 7, 7, 4, 0);
                gfx.DrawLine(shadowPen, 3, 0, 0, 7);
            }

            else if (type == ArrowType.Descending)
            {
                gfx.DrawLine(lightPen, 4, 7, 7, 0);
                gfx.DrawLine(shadowPen, 3, 7, 0, 0);
                gfx.DrawLine(shadowPen, 0, 0, 7, 0);
            }

            gfx.Dispose();

            return bmp;
        }
Ejemplo n.º 57
0
 void AddArrowIcon(int i, ArrowType arrowType)
 {
     slotList[i].sprite = GetArrowIcon(arrowType);
     slotList[i].enabled = true;
 }
Ejemplo n.º 58
0
 public ContinuingTerm(ArrowType type, T term)
 {
     ArrowType = type;
     Term      = term;
 }
Ejemplo n.º 59
0
 private static Field CreateField(ArrowType type, int iteration)
 {
     return(new Field(type.Name + iteration, type, nullable: false));
 }
Ejemplo n.º 60
0
    public override void Update()
    {
        base.Update();

        if ((canShoot || canSpecialShot) && !quiverReady)
        {
            tutorialQuiver();
        }

        Quaternion direction = Quaternion.LookRotation(getMouseDirection());
        Vector3    extraZ    = direction * (new Vector3(0, 0, 1.3f));

        if (!isDead)
        {
            if (((Input.GetMouseButton(0) && canShoot) || (Input.GetMouseButton(1) && canSpecialShot && currentAmmo != ArrowType.Arrow)) && shotTimer >= bow.getReloadDelay())
            {
                if (!(Input.GetMouseButton(0) && Input.GetMouseButton(1)))
                {
                    if (!isCharging)
                    {
                        if (Input.GetMouseButton(1) && quiver.arrowInQuiver(currentAmmo))
                        {
                            bow.initializeRangeIndicator(direction, currentAmmo, true);
                        }
                        else
                        {
                            bow.initializeRangeIndicator(direction, ArrowType.Arrow, true);
                        }
                    }

                    bow.updateIndicator(direction);
                    bow.Charge();
                    isCharging = true;
                    if (currentMovementSpeed > chargingMovementSpeed)
                    {
                        currentMovementSpeed -= Time.deltaTime;
                    }
                }
                else
                {
                    bow.resetCharge();
                    isCharging           = false;
                    currentMovementSpeed = movementSpeed;
                    shotTimer            = 0.90f;
                }
            }
            else if (Input.GetMouseButtonUp(0) && shotTimer >= bow.getReloadDelay() && isCharging && canShoot)
            {
                this.rigidbody.velocity = new Vector3(0, 0, 0);
                GameObject arrowThing = (GameObject)Instantiate(Resources.Load("ArrowPrefab"), this.transform.position + extraZ, direction);

                Arrow arrowComponent = arrowThing.AddComponent <Arrow> ();

                arrowComponent.owner = this.gameObject;
                bow.Release(direction, arrowThing);
                isCharging = false;
                shotTimer  = 0;
                moveTimer  = 0;
                if (!isSlowed)
                {
                    currentMovementSpeed = movementSpeed;
                }
            }
            else if (Input.GetMouseButtonUp(1) && shotTimer >= bow.getReloadDelay() && isCharging && canSpecialShot)
            {
                this.rigidbody.velocity = new Vector3(0, 0, 0);
                GameObject arrowThing = (GameObject)Instantiate(Resources.Load("ArrowPrefab"), this.transform.position + extraZ, direction);

                Arrow arrowComponent = null;
                if (quiver.pullArrow(currentAmmo))
                {
                    switch (currentAmmo)
                    {
                    case ArrowType.FireArrow:
                        arrowComponent = arrowThing.AddComponent <FireArrow> ();
                        break;

                    case ArrowType.IceArrow:
                        arrowComponent = arrowThing.AddComponent <IceArrow> ();
                        break;

                    case ArrowType.ForceArrow:
                        arrowComponent = arrowThing.AddComponent <ForceArrow> ();
                        break;

                    case ArrowType.SplitArrow:
                        arrowComponent = arrowThing.AddComponent <SplitArrow> ();
                        break;

                    case ArrowType.PiercingArrow:
                        arrowComponent = arrowThing.AddComponent <PiercingArrow> ();
                        break;

                    case ArrowType.TreeArrow:
                        arrowComponent = arrowThing.AddComponent <TreeArrow> ();
                        break;

                    default:
                        arrowComponent = arrowThing.AddComponent <Arrow>();
                        break;
                    }
                }
                else
                {
                    arrowComponent = arrowThing.AddComponent <Arrow> ();
                }

                arrowComponent.owner = this.gameObject;

                bow.Release(direction, arrowThing);
                isCharging = false;
                shotTimer  = 0;
                moveTimer  = 0;
                if (!isSlowed)
                {
                    currentMovementSpeed = movementSpeed;
                }
            }
        }
        else
        {
            bow.resetCharge();
            isCharging = false;
        }

        if (Input.GetKeyDown(KeyCode.Space) & !abilityExecuted & !abilityOnCooldown & !isDead && !movementLocked && canDash)
        {
            if (Vector3.Magnitude(this.gameObject.rigidbody.velocity) != 0)
            {
                this.gameObject.AddComponent <Accelerate>().Initialize(
                    50.0f * Vector3.Normalize(this.gameObject.rigidbody.velocity),
                    0.4f, 4.0f, true);
                abilityExecuted = true;
                AudioSource source = AudioHelper.PlayClipAt(dashSound, this.gameObject.transform.position);
                source.rolloffMode = AudioRolloffMode.Linear;
                source.maxDistance = 50.0f;

                dashSystem = (GameObject)Instantiate(Resources.Load("Particles/Air Dash Effect"), this.transform.position - (Vector3.Normalize(this.gameObject.rigidbody.velocity)),
                                                     Quaternion.LookRotation(Vector3.Normalize(-this.gameObject.rigidbody.velocity)));
                dashSystem.transform.parent = gameObject.transform;
                Destroy(dashSystem, 0.4f);
            }
        }
        else if (moveDelay <= 0.0f && !abilityExecuted && !isDead && !movementLocked && canMove)
        {
            this.gameObject.rigidbody.velocity = new Vector3();

            if (Input.GetKey(KeyCode.W))
            {
                currentMovement -= new Vector3(0.0f, 0.0f, currentMovementSpeed);
            }

            if (Input.GetKey(KeyCode.S))
            {
                currentMovement += new Vector3(0.0f, 0.0f, currentMovementSpeed);
            }

            if (Input.GetKey(KeyCode.A))
            {
                currentMovement += new Vector3(currentMovementSpeed, 0.0f, 0.0f);
            }

            if (Input.GetKey(KeyCode.D))
            {
                currentMovement -= new Vector3(currentMovementSpeed, 0.0f, 0.0f);
            }

            this.gameObject.rigidbody.velocity = currentMovement;
            if (Vector3.Magnitude(this.gameObject.rigidbody.velocity) > 0)
            {
                this.gameObject.transform.rotation = Quaternion.LookRotation(Vector3.Normalize(this.gameObject.rigidbody.velocity));
                anim.SetFloat("Speed", 5);
            }
            else
            {
                anim.SetFloat("Speed", 0);
            }
            currentMovement = new Vector3();
        }
        else if (moveDelay > 0.0f)
        {
            moveDelay -= Time.deltaTime;
        }
        if (canSpecialShot)
        {
            if (Input.GetKey(KeyCode.Alpha1) && Application.loadedLevelName == "FireArrow")
            {
                currentAmmo = quiver.arrows[1].type;
            }
            if (Input.GetKey(KeyCode.Alpha2) && Application.loadedLevelName == "IceArrow")
            {
                currentAmmo = quiver.arrows[2].type;
            }
            if (Input.GetKey(KeyCode.Alpha3) && Application.loadedLevelName == "ForceArrow")
            {
                currentAmmo = quiver.arrows[3].type;
            }
            if (Input.GetKey(KeyCode.Alpha4) && Application.loadedLevelName == "TreeArrow")
            {
                currentAmmo = quiver.arrows[4].type;
            }
            if (Input.GetKey(KeyCode.Alpha5) && Application.loadedLevelName == "PiercingArrow")
            {
                currentAmmo = quiver.arrows[5].type;
            }
            if (Input.GetKey(KeyCode.Alpha6) && Application.loadedLevelName == "SplitArrow")
            {
                currentAmmo = quiver.arrows[6].type;
            }
        }
        if (Application.loadedLevelName == "tutorial")
        {
            float scrollWheel = Input.GetAxis(("Mouse ScrollWheel"));

            if (Input.GetKeyDown(KeyCode.Q) || scrollWheel < 0.0f)
            {
                if (((int)currentAmmo - 1) <= 0)
                {
                    currentAmmo = quiver.arrows[6].type;
                }
                else
                {
                    currentAmmo = quiver.arrows[(int)currentAmmo - 1].type;
                }
            }

            if (Input.GetKeyDown(KeyCode.E) || scrollWheel > 0.0f)
            {
                if (((int)currentAmmo + 1) == 7)
                {
                    currentAmmo = quiver.arrows[1].type;
                }
                else
                {
                    currentAmmo = quiver.arrows[(int)currentAmmo + 1].type;
                }
            }
        }


        if (abilityCooldown > 0.0f)
        {
            abilityCooldown -= Time.deltaTime;

            if (abilityCooldown <= 0.0f)
            {
                abilityOnCooldown = false;
            }
        }

        shotTimer += Time.deltaTime;
        moveTimer += Time.deltaTime;
        spawnTimer();

        Camera.main.transform.position = new Vector3(this.gameObject.transform.position.x,
                                                     36.0f, this.gameObject.transform.position.z + 10);
    }