Ejemplo n.º 1
0
        /// <summary>
        /// Spawning is a coroutine so we can wait for clear lerp to finish
        /// </summary>
        private IEnumerator DoSpawn(Vector2 targetPosition, float delay)
        {
            while (isLerping)
            {
                yield return(null);
            }
            var types = Enum.GetValues(typeof(DotType));

            dotType = (DotType)UnityEngine.Random.Range(1, types.Length);

            // Fixes scale if post-clear
            transform.localScale = Vector3.one;

            // Queue dropdown lerp
            MoveToPosition(targetPosition, delay);

            // Set start position above screen so dot can lerp down
            targetPosition.y        = Y_DOT_SPAWN;
            transform.localPosition = targetPosition;

            // Resets the DotTouchAnimation obj
            // And anything else that might exist
            foreach (Transform child in transform)
            {
                child.transform.localScale = Vector3.one;
            }
        }
Ejemplo n.º 2
0
        public ActionResult Create(DotViewModels dotView)
        {
            DotType dotType = new DotType();

            dotType = db.DotTypes.Find(dotView.SelectedValuesT.FirstOrDefault());
            Dot dot = new Dot();

            dot      = dotView.Dot;
            dot.Type = dotType.Id;
            db.Dots.Add(dot);
            db.SaveChanges();

            IPCamDot iPCamDot = new IPCamDot();

            iPCamDot.DotId    = dot.Id;
            iPCamDot.IP       = dotView.IP;
            iPCamDot.Port     = dotView.Port;
            iPCamDot.Login    = dotView.Login;
            iPCamDot.Password = dotView.Password;

            db.IPCamDots.Add(iPCamDot);
            db.Dots.Add(dot);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 3
0
        public HotDot(int id, string type, double hp, double mp, double amount, DotType method, int time, int tick,
                      string name, string itemName, string tooltip, string iconName)
        {
            Id = id;
            Types rType;

            rType = Enum.TryParse(type, out rType) ? rType : Types.Unknown;
            Hp    = hp;
            Mp    = mp;
            Time  = time;
            Tick  = tick;
            Effects.Add(new Effect
            {
                Type   = rType,
                Amount = amount,
                Method = method,
            });
            Name       = name;
            ShortName  = name;
            ItemName   = itemName;
            Tooltip    = tooltip;
            IconName   = iconName;
            Debuff     = (rType == Types.Endurance || rType == Types.CritResist) && amount <= 1 || rType == Types.Mark || (rType == Types.DefPotion && amount > 1);
            HPMPChange = rType == Types.HPChange || rType == Types.MPChange;
            Buff       = rType != Types.HPChange && rType != Types.MPChange;
        }
        /// <summary>
        /// Returns the color for a dot for the current theme.
        /// </summary>
        public Color FromDotType(DotType type)
        {
            switch (type)
            {
            case DotType.Cleared:
                return(Color.clear);

            case DotType.DotA:
                return(dotA);

            case DotType.DotB:
                return(dotB);

            case DotType.DotC:
                return(dotC);

            case DotType.DotD:
                return(dotD);

            case DotType.DotE:
                return(dotE);

            default:
                return(Color.white);    // Easy to notice invalid behaviour
            }
        }
Ejemplo n.º 5
0
        public HotDot(int id, string type, double hp, double mp, double amount, DotType method, uint time, int tick,
                      string name, string itemName, string tooltip, string iconName, AbnormalityType abType, bool isBuff, bool isShow, string effectIcon)
        {
            Id = id;
            Types rType;

            rType  = Enum.TryParse(type, out rType) ? rType : Types.Unknown;
            AbType = abType;
            IsBuff = isBuff;
            IsShow = isShow || id == 10152050;//BF counter
            Hp     = hp;
            Mp     = mp;
            Time   = time;
            Tick   = tick;
            Effects.Add(new Effect
            {
                Type   = rType,
                Amount = amount,
                Method = method,
            });
            Name       = name;
            ShortName  = name;
            ItemName   = itemName;
            Tooltip    = tooltip;
            IconName   = String.Intern(iconName);
            EffectIcon = String.Intern(effectIcon);
            Debuff     = rType == Types.Endurance || rType == Types.CritResist && amount <= 1 || rType == Types.Mark || (rType == Types.DefPotion && amount > 1);
            HPMPChange = rType == Types.HPChange || rType == Types.MPChange;
            Buff       = rType != Types.HPChange;// && rType != Types.MPChange;//try to show MPChange abnormals
        }
Ejemplo n.º 6
0
 public void Configure(BoardController board, int x, int y, DotType dotType)
 {
     ChangeTarget(x, y);
     transform.position = target;
     this.board         = board;
     transform.parent   = board.gameObject.transform;
     SetType(dotType);
 }
Ejemplo n.º 7
0
    /// Retracts the segment towards the new player dot and removes the old one
    void RemoveDot(bool removeDot0)
    {
        //StartCoroutine(RadiusFade(true));

        bool switchSegmentDirection = false;

        if (removeDot0 && dot0 != null)
        {
            dot0.Remove();
            dot0 = null;

            if (dot1 != null)
            {
                if (newestDot == DotType.Dot1)
                {
                    switchSegmentDirection = true;
                }
                newestDot = DotType.Dot1;
                FadeRadius(true);
            }
            else
            {
                FadeRadius(false);
            }
        }
        else if (!removeDot0 && dot1 != null)
        {
            dot1.Remove();
            dot1 = null;

            if (dot0 != null)
            {
                if (newestDot == DotType.Dot0)
                {
                    switchSegmentDirection = true;
                }
                newestDot = DotType.Dot0;
                FadeRadius(true);
            }
            else
            {
                FadeRadius(false);
            }
        }

        // both dots are gone => Death/Restart
        if (dot1 == null && dot0 == null)
        {
            Game.SetState(Game.State.Death);
            radius        = 0;
            radiusOpacity = 0;
            newestDot     = DotType.None;
        }


        // empty the segment in between those two dots
        playerSegment.EmptySegment(switchSegmentDirection);
    }
Ejemplo n.º 8
0
 public override void DrawLowerPropertyBox()
 {
     EditorGUI.BeginChangeCheck();
     dotType = (DotType)UndoableEnumPopup(lowerRect, dotType, "dot product type");
     if (EditorGUI.EndChangeCheck())
     {
         OnUpdateNode();
     }
 }
Ejemplo n.º 9
0
 public void ClearDot()
 {
     isLerping = true;
     dotType   = DotType.Cleared;
     LeanTween.scale(gameObject, Vector3.zero, 0.2f).onComplete += () =>
     {
         isLerping = false;
     };
 }
Ejemplo n.º 10
0
 public override void DeserializeSpecialData(string key, string value)
 {
     switch (key)
     {
     case "dt":
         dotType = (DotType)int.Parse(value);
         break;
     }
 }
Ejemplo n.º 11
0
    // Retrieves a dot from the pool, with a random type
    public DotController GetNewDot()
    {
        GameObject    dotObject = dotPool.GetFromPool();
        DotController dot       = dotObject.GetComponent <DotController>();
        DotType       dotType   = dotTypes[Random.Range(0, dotTypes.Count)];

        dot.SetDotType(dotType);
        return(dot);
    }
Ejemplo n.º 12
0
        private DotMethod LookUpVirtualMethod(DotType declaringDerivedType, DotMethod virtualMethod)
        {
            var overridingMethod = declaringDerivedType.Methods.FirstOrDefault(m => m.Name == virtualMethod.Name);

            if (overridingMethod == null)
            {
                throw new ArgumentException("A method does not exist in this type. This should not happen, derived types have always defined all virtual methods.");
            }

            return(overridingMethod);
        }
Ejemplo n.º 13
0
 // debug
 private void OnMouseOver()
 {
     if (Input.GetMouseButtonDown(1))
     {
         dotType = DotType.ColorBomb;
         Instantiate(colorBomb, transform.position, Quaternion.identity).Also(bomb =>
         {
             bomb.transform.parent = transform;
         });
     }
 }
Ejemplo n.º 14
0
 private List <DotConstructor> FindConstructors(Type type, DotType inType)
 {
     return(type.GetConstructors(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Public)
            .Select(m => new DotConstructor
                    (
                        inType,
                        m.IsStatic,
                        m.GetParameters().Select(p => p.ParameterType).ToArray(),
                        ilParser.ParseILFromMethod(m).ToList())
                    ).ToList());
 }
Ejemplo n.º 15
0
 public HotDot(int id, string type, double hp, double mp, double amount, DotType method, int time, int tick,
               string name)
 {
     Id     = id;
     Type   = type;
     Hp     = hp;
     Mp     = mp;
     Amount = amount;
     Method = method;
     Time   = time;
     Tick   = tick;
     Name   = name;
 }
Ejemplo n.º 16
0
        private UIElement DrawTextObject(Point point, string text, DotType dotType)
        {
            var nameBlock = new TextBlock();

            CanvasRef.Children.Add(nameBlock);
            nameBlock.Text       = text;
            nameBlock.Foreground = Brushes.White;
            Canvas.SetLeft(nameBlock, point.X + DotRadius);
            Canvas.SetTop(nameBlock, point.Y);
            SetZIndex(nameBlock, _dotTypeZIndexes[dotType]);

            return(nameBlock);
        }
Ejemplo n.º 17
0
        private UIElement DrawPointObject(Point point, Brush color, DotType dotType)
        {
            var dot = new Ellipse()
            {
                Width = DotRadius, Height = DotRadius, Fill = color
            };

            CanvasRef.Children.Add(dot);
            Canvas.SetLeft(dot, point.X);
            Canvas.SetTop(dot, point.Y);
            SetZIndex(dot, _dotTypeZIndexes[dotType]);

            return(dot);
        }
Ejemplo n.º 18
0
 public void RemoveDot(DotType type)
 {
     if (current_hp == 0)
     {
         return;
     }
     foreach (var item in dots)
     {
         if (item.type == type)
         {
             item.duration = 0;
             return;
         }
     }
 }
Ejemplo n.º 19
0
        public void LoadAssembly(string path)
        {
            var refAssembly = Assembly.LoadFrom(path);
            var dotAssembly = new DotAssembly(refAssembly.GetName().Name, false);

            foreach (var refType in refAssembly.GetTypes())
            {
                var dotType = new DotType(refType.Name, dotAssembly);
                dotType.Fields       = FindFields(refType, dotType);
                dotType.Constructors = FindConstructors(refType, dotType);
                dotType.Methods      = FindMethods(refType, dotType);
                dotAssembly.Types.Add(dotType);
            }

            loadedAssemblies.Add(dotAssembly);
        }
Ejemplo n.º 20
0
        private bool TryStartDragPoint(object sender, DotType dotType)
        {
            if (_beziers.Count == 0)
            {
                return(false);
            }
            var ellipse = sender as Ellipse;
            var curve   = ellipse?.Tag as IBezierCurve;

            if (curve == null)
            {
                return(false);
            }
            _draggedBezierPoint = new DraggedBezierPoint(curve, dotType);
            return(true);
        }
Ejemplo n.º 21
0
 private List <DotMethod> FindMethods(Type type, DotType inType)
 {
     return(type.GetMethods(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Public)
            .Select(m => new DotMethod
                    (
                        m.Name,
                        inType,
                        m.IsStatic,
                        m.ReturnType,
                        m.GetParameters().Select(p => p.ParameterType).ToArray(),
                        ilParser.ParseILFromMethod(m).ToList())
     {
         IsAbstract = m.IsAbstract,
         IsVirtual = m.IsVirtual
     }
                    ).ToList());
 }
Ejemplo n.º 22
0
 public Point GetPoint(DotType type)
 {
     if (type == DotType.Control1)
     {
         return(BezierSegment.Point1);
     }
     else if (type == DotType.Control2)
     {
         return(BezierSegment.Point2);
     }
     else if (type == DotType.Start)
     {
         return(PathFigure.StartPoint);
     }
     else //if (type == DotType.End)
     {
         return(BezierSegment.Point3);
     }
 }
Ejemplo n.º 23
0
 private void MakeOneOfSwappedDotsABomb(Dot currentDot, DotType bombType)
 {
     currentDot?.Also(dot =>
     {
         if (dot.isMatched)
         {
             dot.MakeBomb(bombType);
         }
         else
         {
             currentDot.otherDot?.GetComponent <Dot>()?.Also(other =>
             {
                 if (other.isMatched)
                 {
                     other.MakeBomb(bombType);
                 }
             });
         }
     });
 }
Ejemplo n.º 24
0
        public void Update(int id, string type, double hp, double mp, double amount, DotType method, uint time, int tick,
                           string name, string itemName, string tooltip, string iconName)
        {
            Types rType;

            rType = Enum.TryParse(type, out rType) ? rType : Types.Unknown;
            if (Effects.Any(x => x.Type == rType))
            {
                return;                                    // already added - duplicate strings with the same id and type in tsv (different item names - will be deleted soon)
            }
            Hp   = rType == Types.HPChange ? hp : Hp;
            Mp   = rType == Types.MPChange ? mp : Mp;
            Tick = rType == Types.MPChange || rType == Types.HPChange ? tick : Tick; //assume that hp and mp tick times should be the same for one abnormality id
            Effects.Add(new Effect
            {
                Type   = rType,
                Amount = amount,
                Method = method
            });
            Debuff     = Debuff || (rType == Types.Endurance || rType == Types.CritResist) && amount < 1 || rType == Types.Mark || (rType == Types.DefPotion && amount > 1);
            HPMPChange = HPMPChange || rType == Types.HPChange || rType == Types.MPChange;
            Buff       = Buff || (rType != Types.HPChange); // && rType != Types.MPChange);//try to show MPChange abnormals
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Set anchor point.
        /// </summary>
        /// <param name="point">Point coordinates.</param>
        /// <param name="dotType">Dot type.</param>
        /// <param name="color">Цвет рисуемой точки.</param>
        public void DrawPoint(Point point, DotType dotType, Brush color = null)
        {
            switch (dotType)
            {
            case DotType.Anchor:
                DrawAnchor(point);
                break;

            case DotType.CurrentTrack:
                DrawCurrentTrack(point);
                break;

            case DotType.Random:
                DrawRandom(point);
                break;

            case DotType.Track:
                DrawTrack(point, color);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(dotType), dotType, null);
            }
        }
Ejemplo n.º 26
0
    public void MakeBomb(DotType type)
    {
        if (dotType == type)
        {
            return;
        }
        isMatched = false;
        dotType   = type;
        GameObject bombToInstantiate = null;

        switch (dotType)
        {
        case DotType.ColumnBomb:
            bombToInstantiate = columnBomb;
            break;

        case DotType.RowBomb:
            bombToInstantiate = rowBomb;
            break;

        case DotType.ColorBomb:
            bombToInstantiate = colorBomb;
            break;

        case DotType.AdjacentBomb:
            bombToInstantiate = adjacentBomb;
            break;

        default:
            throw new InvalidOperationException("Bomb type not handled");
        }
        Instantiate(bombToInstantiate, transform.position, Quaternion.identity).Also(arrow =>
        {
            arrow.transform.parent = transform;
        });
    }
Ejemplo n.º 27
0
 public void SetSpriteToBlack()
 {
     spriteRenderer.sprite = blackDot;
     type = DotType.Black;
 }
Ejemplo n.º 28
0
 public DraggedBezierPoint(IBezierCurve curve, DotType type)
 {
     Curve = curve;
     Type  = type;
 }
Ejemplo n.º 29
0
 public void SetSpriteToWhite()
 {
     spriteRenderer.sprite = whiteDot;
     type = DotType.White;
 }
Ejemplo n.º 30
0
 public void SetSpriteToBlank()
 {
     spriteRenderer.sprite = null;
     type = DotType.Blank;
 }
Ejemplo n.º 31
0
 public void SwapDotType()
 {
     if (type == DotType.Black) {
         type = DotType.White;
     } else if (type == DotType.White) {
         type = DotType.Black;
     }
 }
Ejemplo n.º 32
0
 public void setParams(DotType type, bool fadeout, bool invert)
 {
     this.fadeout = fadeout;
     this.invert = invert;
     this.dotType = type;  
 }
Ejemplo n.º 33
0
 private List <DotField> FindFields(Type type, DotType inType)
 {
     return(type.GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Public)
            .Select(f => new DotField(f.Name, inType))
            .ToList());
 }
Ejemplo n.º 34
0
 public StringConcat2(DotType type) : base(type, new[] { typeof(string), typeof(string) })
 {
 }
Ejemplo n.º 35
0
        /// <summary>
        /// Initialize types from mscorlib that are used in the chosen problem.
        /// </summary>
        private void LoadFramework()
        {
            var fwAssembly = new DotAssembly("mscorlib", true);

            var objectType = new DotType("Object", fwAssembly);

            objectType.Constructors.Add(new ObjectCtor(objectType));
            objectType.Methods.Add(new ObjectToString(objectType));
            fwAssembly.Types.Add(objectType);

            var stringType = new DotType("String", fwAssembly);

            stringType.Fields.Add(new DotField("Value", stringType));
            stringType.Methods = new List <DotMethod>
            {
                new StringConcat2(stringType),
                new StringConcat3(stringType),
                new StringFormat(stringType),
                new StringJoin(stringType),
                new StringSplit(stringType)
            };
            fwAssembly.Types.Add(stringType);

            var intType = new DotType("Int32", fwAssembly);

            intType.Methods.Add(new Int32Parse(intType));
            fwAssembly.Types.Add(intType);

            var arrayType = new DotType("Array", fwAssembly);

            arrayType.Fields = new List <DotField>
            {
                new DotField("Values", arrayType),
                new DotField("Length", arrayType),
                new DotField("ElementType", arrayType)
            };
            fwAssembly.Types.Add(arrayType);

            var listType = new DotType("List`1", fwAssembly);

            listType.Fields.Add(new DotField("Values", listType));
            listType.Constructors.Add(new ListCapacityCtor(listType));
            listType.Methods = new List <DotMethod>
            {
                new ListAdd(listType),
                new ListAddRange(listType),
                new ListGetCount(listType),
                new ListGetItem(listType),
                new ListGetRange(listType),
                new ListIndexOf(listType),
                new ListInsert(listType),
                new ListRemoveAt(listType),
                new ListRemoveRange(listType)
            };
            fwAssembly.Types.Add(listType);

            var fileType = new DotType("File", fwAssembly);

            fileType.Methods = new List <DotMethod>
            {
                new FileReadAllLines(fileType),
                new FileWriteAllText(fileType)
            };
            fwAssembly.Types.Add(fileType);

            var enviType = new DotType("Environment", fwAssembly);

            enviType.Methods.Add(new EnvironmentGetNewLine(enviType));
            fwAssembly.Types.Add(enviType);

            loadedAssemblies.Add(fwAssembly);
        }