Ejemplo n.º 1
0
 public static void CompleteDailyPic(int id, int time, int size, FillAlgorithm fillType, int hintsUsed)
 {
     AnalyticsManager.Log("coloring_finished_daily", new Dictionary <string, string>
     {
         {
             "id",
             id.ToString()
         },
         {
             "time_5s",
             time.ToString()
         },
         {
             "size",
             size.ToString()
         },
         {
             "hints_used",
             hintsUsed.ToString()
         },
         {
             "filltype",
             fillType.ToString().ToLower()
         }
     }, false);
     TGFModule.Instance.GameFinish(id, time, size, fillType);
 }
Ejemplo n.º 2
0
 public void ForceFinishAnimation()
 {
     if (!this.IsAnimating)
     {
         return;
     }
     this.IsAnimating = false;
     if (this.colorCoroutine != null)
     {
         base.StopCoroutine(this.colorCoroutine);
     }
     for (int i = this.colorStepIndex; i < this.steps.Count; i++)
     {
         FillAlgorithm fillType = this.paintFill.FillType;
         if (fillType != FillAlgorithm.Flood)
         {
             if (fillType == FillAlgorithm.Chop)
             {
                 (this.paintFill as ChopFill).FillOnCopy(this.steps[i].point, this.IdToColor(this.steps[i].colorId), this.pixels);
             }
         }
         else
         {
             (this.paintFill as FloodFill).FillOnCopy(this.steps[i].point, this.IdToColor(this.steps[i].colorId), this.pixels);
         }
     }
     this.drawTex.LoadRawTextureData(this.pixels);
     this.drawTex.Apply(false);
 }
Ejemplo n.º 3
0
 public static void RestartPic(int id, int progress, string screenFrom, int size, FillAlgorithm fillType)
 {
     AnalyticsManager.Log("coloring_restart", new Dictionary <string, string>
     {
         {
             "id",
             id.ToString()
         },
         {
             "percent",
             progress.ToString()
         },
         {
             "from",
             screenFrom
         },
         {
             "size",
             size.ToString()
         },
         {
             "filltype",
             fillType.ToString().ToLower()
         }
     }, false);
     TGFModule.Instance.GameStarted(id, size, fillType);
     Answers.LogLevelStart(id.ToString(), null);
 }
Ejemplo n.º 4
0
    private IEnumerator ColorStepByStep()
    {
        yield return(new WaitForSeconds(0.5f));

        for (int i = 0; i < this.steps.Count; i++)
        {
            FillAlgorithm fillType = this.paintFill.FillType;
            if (fillType != FillAlgorithm.Flood)
            {
                if (fillType == FillAlgorithm.Chop)
                {
                    (this.paintFill as ChopFill).FillOnCopy(this.steps[i].point, this.IdToColor(this.steps[i].colorId), this.pixels);
                }
            }
            else
            {
                (this.paintFill as FloodFill).FillOnCopy(this.steps[i].point, this.IdToColor(this.steps[i].colorId), this.pixels);
            }
            this.drawTex.LoadRawTextureData(this.pixels);
            this.drawTex.Apply(false);
            this.colorStepIndex = i;
            yield return(new WaitForSeconds(0.04f));
        }
        yield return(0);

        this.colorCoroutine = null;
        this.IsAnimating    = false;
        PlayTimeEventTracker.AnimWatched();
        this.OpenControls();
        yield break;
    }
Ejemplo n.º 5
0
 public PictureData(PictureType type, int pId, int id, FillAlgorithm fillType)
 {
     this.picType  = type;
     this.PackId   = pId;
     this.Id       = id;
     this.FillType = fillType;
     this.PicClass = PicClass.Common;
 }
Ejemplo n.º 6
0
 public void GameStarted(int picId, int size, FillAlgorithm fillType)
 {
     if (this.CanSend)
     {
         WWWForm wwwform = this.GameActionForm(picId);
         wwwform.AddField("sub_action", "start");
         wwwform.AddField("size", size.ToString());
         wwwform.AddField("filltype", fillType.ToString().ToLower());
         base.StartCoroutine(this.POST(wwwform));
     }
 }
Ejemplo n.º 7
0
    public static PictureData ToPictureData(PictureDb p)
    {
        FillAlgorithm fillType = DbTypeConvertor.FillAlgFromDb(p.FillType);

        return(new PictureData(PictureType.Local, p.PackId, p.PicId, fillType)
        {
            HasSave = (p.HasSave == 1),
            Solved = (p.Solved == 1),
            PicClass = DbTypeConvertor.PicClassFromDb(p.PicClass)
        });
    }
Ejemplo n.º 8
0
 private static int FillAlgToDb(FillAlgorithm fill)
 {
     if (fill == FillAlgorithm.Flood)
     {
         return(0);
     }
     if (fill == FillAlgorithm.Chop)
     {
         return(1);
     }
     return(1);
 }
Ejemplo n.º 9
0
    private IEnumerator ColorStepByStep(float delay = 0f, float postDelay = 0f)
    {
        if (delay > 0f)
        {
            yield return(new WaitForSeconds(delay));
        }
        for (int i = 0; i < this.steps.Count; i++)
        {
            FillAlgorithm fillType = this.paintFill.FillType;
            if (fillType != FillAlgorithm.Flood)
            {
                if (fillType == FillAlgorithm.Chop)
                {
                    (this.paintFill as ChopFill).FillOnCopy(this.steps[i].point, this.IdToColor(this.steps[i].colorId), this.pixels);
                }
            }
            else
            {
                (this.paintFill as FloodFill).FillOnCopy(this.steps[i].point, this.IdToColor(this.steps[i].colorId), this.pixels);
            }
            this.drawTex.LoadRawTextureData(this.pixels);
            this.drawTex.Apply(false);
            this.colorStepIndex = i;
            yield return(new WaitForSeconds(0.04f));
        }
        if (postDelay > 0f)
        {
            float currentTime = 0f;
            while (currentTime < postDelay)
            {
                currentTime += Time.deltaTime;
                yield return(null);
            }
        }
        yield return(0);

        this.colorCoroutine = null;
        this.IsAnimating    = false;
        if (this.Completed != null)
        {
            this.Completed();
        }
        yield break;
    }
Ejemplo n.º 10
0
 public static void StartNewColoring(int id, int size, FillAlgorithm fillType)
 {
     AnalyticsManager.Log("coloring_start", new Dictionary <string, string>
     {
         {
             "id",
             id.ToString()
         },
         {
             "size",
             size.ToString()
         },
         {
             "filltype",
             fillType.ToString().ToLower()
         }
     }, false);
     TGFModule.Instance.GameStarted(id, size, fillType);
     Answers.LogLevelStart(id.ToString(), null);
 }
Ejemplo n.º 11
0
    private void FillPoint(Point pColor, int colorId, bool writeData = true)
    {
        int           zoneId        = -1;
        FillAlgorithm fillAlgorithm = this.fillType;

        if (fillAlgorithm != FillAlgorithm.Flood)
        {
            if (fillAlgorithm == FillAlgorithm.Chop)
            {
                zoneId = this.chopFill.FillPoint(pColor, this.palette.IdToColor(colorId), writeData);
                this.numController.FilledZone(zoneId);
            }
        }
        else
        {
            this.floodFill.FillPoint(pColor, this.palette.IdToColor(colorId), writeData);
        }
        this.save.AddStep(colorId, pColor);
        if (writeData)
        {
            AnalyticsManager.LevelProgress(Gameboard.pictureData.Id, this.currentGUID, zoneId, this.save.StepCount);
        }
        this.UpdateSave(writeData);
        bool flag = this.validator.Filled(colorId);

        if (flag)
        {
            this.palette.MarkCurrentUsed(colorId);
        }
        if (this.validator.Solved)
        {
            this.boardController.Click -= this.OnClick;
            if (this.Solved != null)
            {
                this.Solved();
            }
        }
    }
Ejemplo n.º 12
0
 public bool IsValid()
 {
     this.FillType = this.ParseFillType(this.fillType);
     return(!string.IsNullOrEmpty(this.lineart) && !string.IsNullOrEmpty(this.icon) && (this.FillType != FillAlgorithm.Flood || !string.IsNullOrEmpty(this.colored)) && !string.IsNullOrEmpty(this.json));
 }
Ejemplo n.º 13
0
    private void Create(Texture2D l, Texture2D c, PaletteData p)
    {
        FillAlgorithm fillAlgorithm = this.fillType;

        if (fillAlgorithm != FillAlgorithm.Flood)
        {
            if (fillAlgorithm == FillAlgorithm.Chop)
            {
                this.chopFill = new ChopFill();
                this.chopFill.Create(l, p, true);
                this.sourceImg.texture = l;
                this.drawImg.texture   = this.chopFill.DrawTex;
                this.imageRect         = this.sourceImg.rectTransform.rect;
                this.paintFill         = this.chopFill;
            }
        }
        else
        {
            this.floodFill = new FloodFill();
            this.floodFill.Create(l, c, p);
            this.sourceImg.texture = l;
            this.drawImg.texture   = this.floodFill.DrawTex;
            this.imageRect         = this.sourceImg.rectTransform.rect;
            this.paintFill         = this.floodFill;
        }
        this.paletteData = p;
        PaletteData  paletteData = p;
        List <Color> list        = new List <Color>();

        for (int i = 0; i < paletteData.entities.Length; i++)
        {
            paletteData.entities[i].color.a = byte.MaxValue;
            PaletteEntity paletteEntity = paletteData.entities[i];
            list.Add(paletteEntity.color);
        }
        this.numController.Init(new Func <int, Vector2>(this.TextureIndexToCanvas), this.imageRect.width / (float)this.paintFill.TexWidth);
        this.numController.Create(paletteData);
        this.palette.Create(list);
        this.palette.NewColor += delegate(int cId)
        {
            this.highlighter.HighlightColor(cId);
        };
        FillAlgorithm fillAlgorithm2 = this.fillType;

        if (fillAlgorithm2 != FillAlgorithm.Flood)
        {
            if (fillAlgorithm2 == FillAlgorithm.Chop)
            {
                ChopHighlightController component = this.highlightGameObject.GetComponent <ChopHighlightController>();
                component.Init(this.chopFill, paletteData, this.numController);
                this.highlighter = component;
            }
        }
        else
        {
            FloodHighlightController component2 = this.highlightGameObject.GetComponent <FloodHighlightController>();
            component2.Init(this.floodFill.Paint, paletteData, this.paintFill.DrawTex);
            this.highlighter = component2;
        }
        this.validator = new LevelValidator();
        this.validator.Init(paletteData);
        this.save = new BoardSave();
        this.boardController.Init(this.numController);
        this.boardController.Click += this.OnClick;
    }
Ejemplo n.º 14
0
 public static void ContinuePic(int id, int progress, string screenFrom, int size, FillAlgorithm fillType)
 {
     AnalyticsManager.Log("coloring_continue", new Dictionary <string, string>
     {
         {
             "id",
             id.ToString()
         },
         {
             "percent",
             progress.ToString()
         },
         {
             "from",
             screenFrom
         },
         {
             "size",
             size.ToString()
         },
         {
             "filltype",
             fillType.ToString().ToLower()
         }
     }, false);
     TGFModule.Instance.GameContinue(id, size, fillType);
 }