Example #1
0
 void Awake()
 {
     PkB = GameObject.FindGameObjectWithTag("DataBase").GetComponent<PkBase>();
     Mov = GameObject.FindGameObjectWithTag("DataBase").GetComponent<Mov>();
     Hab = GameObject.FindGameObjectWithTag("DataBase").GetComponent<Habilidad>();
     CId1 = GameObject.FindGameObjectWithTag("Pk1").GetComponent<CaracId>();
     CId2 = GameObject.FindGameObjectWithTag("Pk2").GetComponent<CaracId>();
 }
Example #2
0
        public override void draw(SpriteBatch sprite_batch, Vector2 draw_offset = default(Vector2))
        {
            Vector2 loc = this.loc + draw_vector();

            sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, Scissor_State);
            Pow.draw(sprite_batch, draw_offset - loc);
            Skl.draw(sprite_batch, draw_offset - loc);
            Spd.draw(sprite_batch, draw_offset - loc);
            Lck.draw(sprite_batch, draw_offset - loc);
            Def.draw(sprite_batch, draw_offset - loc);
            Res.draw(sprite_batch, draw_offset - loc);
            Mov.draw(sprite_batch, draw_offset - loc);
            Con.draw(sprite_batch, draw_offset - loc);
            Aid.draw(sprite_batch, draw_offset - loc);
            sprite_batch.End();
        }
Example #3
0
        public bool Optimize(ref List <Instruction> src)
        {
            if (CurrentIndex < 1)
            {
                return(false);
            }
            if (!(src[CurrentIndex] is InstructionWithDestinationAndSourceAndSize))
            {
                return(false);
            }
            InstructionWithDestinationAndSourceAndSize Operator = src[CurrentIndex] as InstructionWithDestinationAndSourceAndSize;


            Move       = OptimizeUtils.GetLastMove(src, CurrentIndex - 1, ref MoveIdx);
            SecondMove = OptimizeUtils.GetLastMove(src, MoveIdx - 1, ref SecondMoveIdx);

            if (Move != null && SecondMove == null) // just a single mov
            {
                // optimize
                src[MoveIdx].Emit = false;           // eliminate mov
                OptimizeUtils.CopySource(Move, ref Operator, true);

                Optimizer.Optimizations     += 1;
                Optimizer.OptimizationsSize += 3;
                Optimizations++;
            }
            else if (Move != null && !OptimizeUtils.BothIndirect(Move, SecondMove, true) && !OptimizeUtils.IsImmediate(SecondMove, true)) // just a single mov (s
            {
                // optimize
                src[MoveIdx].Emit       = false; // eliminate mov
                src[SecondMoveIdx].Emit = false; // eliminate mov

                OptimizeUtils.CopySource(Move, ref Operator, true);
                OptimizeUtils.CopySource(SecondMove, ref Operator, false);

                Optimizer.Optimizations     += 2;
                Optimizer.OptimizationsSize += 6;
                Optimizations++;
            }
            else
            {
                return(false);
            }


            return(true);
        }
Example #4
0
        public Image GetPreview()
        {
            ControlPlus.TipImage tipData = new ControlPlus.TipImage(160);
            tipData.AddTextNewLine(string.Format("{0} Lv{1}", Name, Level.ToString()), Camp == CampConfig.Indexer.Reborn ? "Lime" : "Red", 20);

            tipData.AddTextNewLine("", "White", 20);
            tipData.AddImageXY(HSIcons.GetIconsByEName("hatt1"), 0, 0, 32, 32, 5, 20, 20, 20);
            tipData.AddTextOff(Atk.ToString(), "White", 30);
            tipData.AddImageXY(HSIcons.GetIconsByEName("hatt2"), 0, 0, 32, 32, 5 + 80, 20, 20, 20);
            tipData.AddTextOff(Def.ToString(), "White", 30 + 80);

            tipData.AddTextNewLine("", "White", 20);
            tipData.AddImageXY(HSIcons.GetIconsByEName("hatt5"), 0, 0, 32, 32, 5, 40, 20, 20);
            tipData.AddTextOff(Mov.ToString(), "White", 30);
            tipData.AddImageXY(HSIcons.GetIconsByEName("hatt8"), 0, 0, 32, 32, 5 + 80, 40, 20, 20);
            tipData.AddTextOff(Range.ToString(), "White", 30 + 80);

            tipData.AddTextNewLine("", "White", 20);
            tipData.AddImageXY(HSIcons.GetIconsByEName("hatt7"), 0, 0, 32, 32, 5, 60, 20, 20);
            tipData.AddTextOff(string.Format("{0}/{1}", LeftHp, baseAttr.Hp), "White", 30);

            return(tipData.Image);
        }
Example #5
0
        public void ProcessRequest(HttpContext context)
        {
            Mov _mov = new Mov();

            byte[] byteImg = new byte[_mov.ReadImgBLL(3).Length];
            byteImg = _mov.ReadImgBLL(3);

            //Image img = Image.FromFile(@"c:\o1.jpg");
            //MemoryStream stream = new MemoryStream();
            //img.Save(stream, ImageFormat.Png);

            //img.Dispose();

            //byte[] byteImg = new byte[stream.Length];
            //stream.Position=0;
            //stream.Read(byteImg,0,(int)byteImg.Length);

            //stream.Close();

            context.Response.ContentType = "image/png";

            context.Response.BinaryWrite(byteImg);
        }
Example #6
0
    // Use this for initialization
    void Start()
    {
        player = FindObjectOfType <Mov>();
        ball   = FindObjectOfType <Pool>();


        if (textfile != null)
        {
            textLines = (textfile.text.Split('\n'));
        }
        if (endAtLine == 0)
        {
            endAtLine = textLines.Length - 1;
        }
        if (isActive)
        {
            EnableTextBox();
        }
        else
        {
            DisableTextBox();
        }
    }
        public static bool SameOperands(Mov a)
        {
            bool m = false;

            if (a.DestinationDisplacement == a.SourceDisplacement)
            {
                if (a.DestinationIsIndirect == a.SourceIsIndirect)
                {
                    if (a.DestinationRef == a.SourceRef)
                    {
                        if (a.DestinationReg == a.SourceReg)
                        {
                            if (a.DestinationValue == a.SourceValue)
                            {
                                m = true;
                            }
                        }
                    }
                }
            }

            return(m);
        }
Example #8
0
    void CheckAnimationPoint(IGameEvent e)
    {
        if (e.Sender == gameObject)
        {
            StandardSendGameEvent ssge = (StandardSendGameEvent)e;
            string info = (string)ssge.MyObject[1];
            switch (info)
            {
            case "a":
            case "b":
            case "c":
                Mov.ApplyForce(forDesl * Mathf.Sign(-transform.localScale.x) * Vector3.right, 1);
                EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.EnemySlash));
                break;

            case "d":
                TempoDecorrido = 0;
                _Animator.SetTrigger("retornarAoPadrao");
                estado = EstadoDaqui.movendo;
                break;
            }
        }
    }
 public static bool CopyDestination(Mov src, ref InstructionWithDestinationAndSourceAndSize ins, bool assrc)
 {
     if (assrc && !src.DestinationEmpty)
     {
         ins.SourceReg          = src.DestinationReg;
         ins.SourceValue        = src.DestinationValue;
         ins.SourceRef          = src.DestinationRef;
         ins.Size               = src.Size;
         ins.SourceDisplacement = src.DestinationDisplacement;
         ins.SourceIsIndirect   = src.DestinationIsIndirect;
         return(true);
     }
     else if (!src.DestinationEmpty)
     {
         ins.DestinationReg          = src.DestinationReg;
         ins.DestinationValue        = src.DestinationValue;
         ins.DestinationRef          = src.DestinationRef;
         ins.Size                    = src.Size;
         ins.DestinationDisplacement = src.DestinationDisplacement;
         ins.DestinationIsIndirect   = src.DestinationIsIndirect;
         return(true);
     }
     return(false);
 }
Example #10
0
        /// <summary>
        /// Apply the optimization.
        /// </summary>
        /// <param name="instructions">Instructions.</param>
        public override void Apply(List <Assembler.Instruction> instructions)
        {
            //If a EBP relative push is done, then we can safely replace it by mov instruction
            for (int index = 0; index < instructions.Count; index++)
            {
                if (instructions[index] is Push)
                {
                    var Prev = instructions[index] as Push;
                    if (Prev.DestinationReg != Registers.EBP && Prev.DestinationReg.HasValue)
                    {
                        continue;
                    }

                    //Search for the pop instruction
                    int index2     = index + 1;
                    int StackLevel = 0;
                    for (; index2 < instructions.Count; index2++)
                    {
                        var xNext = instructions[index2];

                        #region We Can't Optimize these cases
                        if (xNext is Label || xNext is Jmp || xNext is Call)
                        {
                            index2 = instructions.Count;
                            break;
                        }
                        if (xNext is OnlyDestination)
                        {
                            var xtemp = xNext as OnlyDestination;
                            if (xtemp.DestinationReg == Registers.ESP)
                            {
                                index2 = instructions.Count;
                                break;
                            }
                        }
                        if (xNext is DestinationSource)
                        {
                            var xtemp = xNext as DestinationSource;
                            if (xtemp.DestinationReg == Registers.ESP || xtemp.SourceReg == Registers.ESP)
                            {
                                index2 = instructions.Count;
                                break;
                            }
                        }
                        if (xNext is DestinationSourceSize)
                        {
                            var xtemp = xNext as DestinationSourceSize;
                            if (xtemp.DestinationReg == Registers.ESP || xtemp.SourceReg == Registers.ESP)
                            {
                                index2 = instructions.Count;
                                break;
                            }
                        }
                        #endregion

                        if (instructions[index2] is Push)
                        {
                            StackLevel++;
                        }
                        if (instructions[index2] is Pop)
                        {
                            if (StackLevel == 0)
                            {
                                break;
                            }
                            --StackLevel;
                        }
                    }

                    if (index2 == instructions.Count)
                    {
                        continue; // No way to optimize this
                    }
                    var Next = instructions[index2] as Pop;

                    var Optimized = new Mov();
                    if (Next.DestinationReg.HasValue)
                    {
                        Optimized.DestinationReg = Next.DestinationReg;
                    }
                    else
                    {
                        Console.WriteLine("@EBP-Push: Impossible Pair!");
                        Optimized.DestinationRef = Next.DestinationRef;
                    }

                    if (Prev.DestinationReg.HasValue)
                    {
                        Optimized.SourceReg = Prev.DestinationReg;
                    }
                    else
                    {
                        Optimized.SourceRef = Prev.DestinationRef;
                    }

                    //Inherit properties
                    Optimized.SourceIndirect     = Prev.DestinationIndirect;
                    Optimized.SourceDisplacement = Prev.DestinationDisplacement;

                    if (Prev.Size != Next.Size && Next.Size != 32)
                    {
                        Console.WriteLine("@push-pop: Warning");
                    }

                    instructions[index2] = Optimized;
                    instructions[index]  = null;
                }
            }
        }
 protected override void OnFinallyAccelerate()
 {
     Mov.AplicadorDeMovimentos(0.25f * (Mov.Velocity.normalized));
     estado = EstadoDaqui.finalizandoInvestida;
 }
Example #12
0
            public Zrub(int start, int stop)
            {
                this.start        = start;
                this.stop         = stop;
                framedelta        = 100;
                phantomframedelta = 5;

                this.moves        = new List <Mov>();
                this.points       = new vec3[27 * 8];
                this._points      = new vec3[27 * 8];
                this.cubes        = new Cube[27];
                this.dottedrects  = new Odottedrect[27 * 6];
                this.cubeintime   = new int[27];
                this.rots         = new Rot[6 + 3];
                this.rots[Cube.L] = new Rot(v3(0f, +1f, 0f));
                this.rots[Cube.R] = new Rot(v3(0f, -1f, 0f));
                this.rots[Cube.F] = new Rot(v3(+1f, 0f, 0f));
                this.rots[Cube.B] = new Rot(v3(-1f, 0f, 0f));
                this.rots[Cube.D] = new Rot(v3(0f, 0f, +1f));
                this.rots[Cube.U] = new Rot(v3(0f, 0f, -1f));
                this.rots[FM]     = new Rot(v3(0f, 0f, -1f));
                this.rots[TMH]    = new Rot(v3(-1f, 0f, 0f));
                this.rots[TMV]    = new Rot(v3(0f, +1f, 0f));

                pretime = sync(2600);
                intime  = sync(500);

                Random rnd = new Random(12071607);

                for (int a = 0; a < 3; a++)
                {
                    for (int b = 0; b < 3; b++)
                    {
                        for (int c = 0; c < 3; c++)
                        {
                            gen(a, b, c);
                            int time = sync(pretime - rnd.Next(pretime - intime) - intime);
                            cubeintime[a * 9 + b * 3 + c] = time;
                        }
                    }
                }

                using (StreamReader r = new StreamReader("rub.txt")) {
                    Dictionary <string, int> mapping = new Dictionary <string, int>();
                    for (int i = 0; i < SIDES.Length; i++)
                    {
                        mapping.Add(SIDES[i], i);
                    }
                    int[] dir = { 1, 1, 1, 1, 1, 1, 1, 1, 1 };
                    foreach (string m in r.ReadToEnd().Split(' '))
                    {
                        if (m == "<")
                        {
                            remap(mapping, Cube.R, Cube.F, Cube.B, Cube.U, Cube.D, Cube.L, FM, TMV, TMH);
                            dir[TMH] *= -1;
                            continue;
                        }
                        if (m == ">")
                        {
                            remap(mapping, Cube.L, Cube.B, Cube.F, Cube.U, Cube.D, Cube.R, FM, TMH, TMV);
                            dir[TMV] *= -1;
                            continue;
                        }
                        if (m == "^")
                        {
                            remap(mapping, Cube.D, Cube.L, Cube.R, Cube.F, Cube.B, Cube.U, TMH, FM, TMV);
                            dir[TMH] *= -1;
                            continue;
                        }
                        Mov mov = new Mov();
                        moves.Add(mov);
                        int l = m.Length - 1;
                        if (m[l] == '2')
                        {
                            mov.mp = 2;
                            l--;
                        }
                        if (m[l] == '\'')
                        {
                            mov.dir = -1;
                            l--;
                        }
                        mov.axis = mapping[m.Substring(0, l + 1)];
                        mov.dir *= dir[mov.axis];
                    }
                }
                movetime = ((stop - start) - pretime) / moves.Count;
                movetime = sync(max(framedelta, movetime));

#if ASRECTS
                List <Rect> coloredrects = new List <Rect>();
                int         idx          = 0;
                foreach (Cube c in cubes)
                {
                    for (int i = 0; i < 6; i++)
                    {
                        Rect r = c.rects[i];
                        if (r.color == defcol)
                        {
                            orects[idx++] = new Orect(r, 0);
                            continue;
                        }
                        coloredrects.Add(c.rects[i]);
                    }
                }
                foreach (Rect r in coloredrects)
                {
                    orects[idx++] = new Orect(r, 0);
                }
#endif
            }
Example #13
0
            public override void draw(SCENE scene)
            {
                screen.clear();
                copy(_points, points);

                if (scene.reltime < pretime)
                {
                    for (int i = 0; i < cubes.Length; i++)
                    {
                        Rect[] r   = { cubes[i].rects[Cube.F], cubes[i].rects[Cube.B] };
                        vec3   mid = (r[0].mid() + r[1].mid()) / 2f;
                        vec3   dir = (mid - Zsc.mid).norm();
                        float  x   = 1f - clamp(progress(cubeintime[i], cubeintime[i] + intime, scene.reltime), 0f, 1f);
                        dir *= x * INOFFSET;
                        r[0].move(dir);
                        r[1].move(dir);
                    }
                }

                int currentmove = max(0, scene.reltime - pretime) / movetime;

                if (currentmove < this.moves.Count && scene.reltime > pretime)
                {
                    float moveprogress = scene.reltime - pretime - currentmove * movetime;
                    moveprogress /= movetime;
                    Mov mov = this.moves[currentmove];
                    Rot rot = this.rots[mov.axis];
                    foreach (Cube c in rot.cubes)
                    {
                        turn(c, Zsc.mid, quat(rot.angles * moveprogress * 30f * mov.dir * mov.mp));
                    }
                }

                Cube[] originalCubePositions = new Cube[cubes.Length];
                Array.Copy(cubes, originalCubePositions, cubes.Length);
                int[,] originalCubePoints = new int[cubes.Length, 4 * 6];
                int[,] cp = new int[cubes.Length, 8];
                R rots = new R();

                for (int i = 0; i < cubes.Length; i++)
                {
                    for (int j = 0; j < cubes[i].rects.Length; j++)
                    {
                        originalCubePoints[i, j * 4 + 0] = cubes[i].rects[j].a;
                        originalCubePoints[i, j * 4 + 1] = cubes[i].rects[j].b;
                        originalCubePoints[i, j * 4 + 2] = cubes[i].rects[j].c;
                        originalCubePoints[i, j * 4 + 3] = cubes[i].rects[j].d;
                    }
                    for (int j = 0; j < 8; j++)
                    {
                        cp[i, j] = pt(i, j);
                    }
                    rots.Add(cubes[i], new List <int[]>());
                }

                Cube[] nc = new Cube[cubes.Length];
                for (int i = 0; i < currentmove && i < moves.Count; i++)
                {
                    int axis   = moves[i].axis;
                    int amount = (moves[i].mp + (1 - (moves[i].mp - 1)) * (((moves[i].dir >> 1) & 1) * 2 + dirfix[axis])) % 4;
                    while (amount-- > 0)
                    {
                        Array.Copy(cubes, nc, cubes.Length);
                        for (int j = 0; j < 9; j++)
                        {
                            rc(nc, cp, rots, movmat[rmref[axis], j], emovmat[axis], rotmat[rmref[axis]]);
                        }
                        Array.Copy(nc, cubes, cubes.Length);
                    }
                }

                for (int i = 0; i < cubes.Length; i++)
                {
                    rc3(i, rots[cubes[i]]);
                }

                if (scene.time > 43250)
                {
                    int  rt = scene.time - 43250;
                    vec4 q  = quat(0f, 0f, -rt / 1000f);
                    turn(_points, Zsc.mid, q);
                }
                if (scene.time > 45450)
                {
                    int  rt = scene.time - 45450;
                    vec4 q  = quat(0f, -rt / 1400f, 0f);
                    turn(_points, Zsc.mid, q);
                }
                if (scene.time > 47650)
                {
                    int  rt = scene.time - 47650;
                    vec4 q  = quat(rt / 2000f, 0f, 0f);
                    turn(_points, Zsc.mid, q);
                }

                Zsc.adjust(_points);

                foreach (Cube c in this.cubes)
                {
                    c.draw(screen);
                }
#if ASDOTS
                foreach (Odottedrect o in this.dottedrects)
                {
                    o.draw(scene, screen);
                }
#else
                screen.draw(scene);
#endif
#if ASRECTS
                foreach (Orect o in orects)
                {
                    o.update(scene);
                }
#endif

                Array.Copy(originalCubePositions, cubes, cubes.Length);

                for (int i = 0; i < cubes.Length; i++)
                {
                    for (int j = 0; j < cubes[i].rects.Length; j++)
                    {
                        int a = originalCubePoints[i, j * 4 + 0];
                        int b = originalCubePoints[i, j * 4 + 1];
                        int c = originalCubePoints[i, j * 4 + 2];
                        int d = originalCubePoints[i, j * 4 + 3];
                        cubes[i].rects[j].updatepts(a, b, c, d);
                    }
                }
            }
Example #14
0
        public bool Optimize(ref List <Instruction> src)
        {
            if (CurrentIndex == -1)
            {
                return(false);
            }

            LeftPopIdx = CurrentIndex;
            LeftPop    = src[CurrentIndex] as Pop;
            if (LeftPop != null)
            {
                RightPop = OptimizeUtils.GetLastPop(src, CurrentIndex - 1, ref RightPopIdx);
                if (RightPop != null)
                {
                    Right = OptimizeUtils.GetLastPush(src, RightPopIdx - 1, ref RightIdx);
                    if (Right != null)
                    {
                        Left = OptimizeUtils.GetLastPush(src, RightIdx - 1, ref LeftIdx);
                        if (Left != null)
                        {
                            if ((RightPop.DestinationIsIndirect && Right.DestinationIsIndirect) || (LeftPop.DestinationIsIndirect && Left.DestinationIsIndirect))
                            {
                                return(false);
                            }
                            if (OptimizeUtils.CrossUsage(Left, RightPop) || OptimizeUtils.CrossUsage(Right, LeftPop))
                            {
                                return(false);
                            }
                            if (OptimizeUtils.IsSegment(Left) || OptimizeUtils.IsSegment(LeftPop) || OptimizeUtils.IsSegment(Right) || OptimizeUtils.IsSegment(RightPop))
                            {
                                return(false);
                            }
                            // optimize
                            src[LeftIdx].Emit  = false;
                            src[RightIdx].Emit = false;

                            InstructionWithDestinationAndSourceAndSize mv = new Mov();
                            OptimizeUtils.CopyDestination((InstructionWithDestinationAndSize)Right, ref mv, true);
                            OptimizeUtils.CopyDestination((InstructionWithDestinationAndSize)RightPop, ref mv, false);
                            src[RightPopIdx] = mv;

                            mv = new Mov();
                            OptimizeUtils.CopyDestination((InstructionWithDestinationAndSize)Left, ref mv, true);
                            OptimizeUtils.CopyDestination((InstructionWithDestinationAndSize)LeftPop, ref mv, false);
                            src[LeftPopIdx] = mv;

                            Optimizer.Optimizations += 2;
                            Optimizations++;
                            Optimizer.OptimizationsSize += 6;
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }

            return(true);
        }