Exemplo n.º 1
0
        protected override void OnShow()
        {
            LogoName.Show();
            LogoName.rectTransform.DOAnchorPosY(-193, 0.5f);

            MenuUI.Show();
            MenuUI.DOAnchorPosY(60, 0.5f);

            CameraCtrl.Instance.ZoomOut();
        }
Exemplo n.º 2
0
        public void StartHide()
        {
            LogoName.rectTransform.DOAnchorPosY(145.6f, 0.5f).OnComplete(() =>
            {
                LogoName.Hide();
            });

            MenuUI.DOAnchorPosY(-84.91797f, 0.5f).OnComplete(() =>
            {
                MenuUI.Hide();
            });
        }
Exemplo n.º 3
0
        public async void CreatePhoto()
        {
            await Task.Run(() =>
            {
                List <Dictionary <string, PhotoCreatorLogic> > valuePairs = new List <Dictionary <string, PhotoCreatorLogic> >();
                int tempPos = 0;
                while (IsWorking || IsPrintAll)
                {
                    List <List <string> > files_all = new List <List <string> >();
                    List <List <string> > files_two = new List <List <string> >();
                    lock (locker)
                    {
                        foreach (var user in UsersInfo)
                        {
                            var res = Directory.GetFiles($@"Photos\{user["id"]}\").ToList();
                            if (res.Count() >= 2)
                            {
                                files_two.Add(res);
                                res.Add(user["id"]);
                            }
                            else if (res.Count() > 0)
                            {
                                files_all.Add(res);
                                res.Add(user["id"]);
                            }
                        }
                    }

                    foreach (var files in files_two)
                    {
                        files[0] = files[0].Remove(0, 7);
                        files[1] = files[1].Remove(0, 7);
                        PhotoCreatorLogic creatorLogic = new PhotoCreatorLogic();

                        if (TemplateName != null)
                        {
                            string[] splitted         = TemplateName.Split('\\');
                            TemplateName              = splitted[splitted.Length - 1];
                            creatorLogic.TemplateName = TemplateName;
                        }
                        if (LogoName != null)
                        {
                            string[] splitted     = LogoName.Split('\\');
                            LogoName              = splitted[splitted.Length - 1];
                            creatorLogic.LogoName = LogoName;
                        }

                        if (Hashtag_1.Length > 0)
                        {
                            creatorLogic.HashtagforDrawing1 = "#" + Hashtag_1;
                        }
                        if (Hashtag_2.Length > 0)
                        {
                            creatorLogic.HashtagforDrawing2 = "#" + Hashtag_2;
                        }

                        creatorLogic.Username = files[files.Count - 1];

                        var imgRs1 = creatorLogic.ResizeImage(640, Environment.CurrentDirectory + @"\Photos\" + files[0]);
                        var imgRs2 = creatorLogic.ResizeImage(640, Environment.CurrentDirectory + @"\Photos\" + files[1]);

                        string oldFile0 = files[0];
                        string oldFile1 = files[1];

                        files[0] = oldFile0.Replace(".jpg", "lp.jpg");
                        files[1] = oldFile1.Replace(".jpg", "lp.jpg");

                        imgRs1.Save(Environment.CurrentDirectory + @"\Photos\" + files[0]); imgRs1.Dispose();
                        imgRs2.Save(Environment.CurrentDirectory + @"\Photos\" + files[1]); imgRs2.Dispose();

                        File.Delete(@"Photos\" + oldFile0); File.Delete(@"Photos\" + oldFile1);

                        string photoName = creatorLogic.CreatePhoto(files[0]);
                        creatorLogic.AddPhoto(photoName, files[1]);
                        creatorLogic.AddLogo(photoName);

                        File.Delete(@"Photos\" + files[0]);
                        File.Delete(@"Photos\" + files[1]);

                        var img             = creatorLogic.ResizeImage(610, photoName);
                        string newPhotoName = photoName.Replace(".jpg", "sp.jpg");
                        img.Save(newPhotoName);
                        img.Dispose();
                        File.Delete(photoName);

                        PrintCl print = new PrintCl(Environment.CurrentDirectory + "\\" + newPhotoName);
                        try { print.PrintImage(); SuccessPrint++; }
                        catch (Exception ex)
                        { Debug.WriteLine(ex.Message + "\n" + ex.StackTrace); UnsuccessPrints++; }
                        File.Delete(newPhotoName);
                    }

                    if (tempPos == 26 || IsPrintAll)
                    {
                        WaitingPrint = files_all.Count;
                        foreach (var files in files_all)
                        {
                            var strs = files[0].Split('\\');
                            var res  = Directory.GetFiles(Environment.CurrentDirectory + @"\Photos\" + $@"{strs[strs.Count() - 2]}");
                            if (res.Count() % 2 == 1)
                            {
                                files[0] = files[0].Remove(0, 7);
                                PhotoCreatorLogic creatorLogic = new PhotoCreatorLogic();

                                if (TemplateName != null)
                                {
                                    string[] splitted         = TemplateName.Split('\\');
                                    TemplateName              = splitted[splitted.Length - 1];
                                    creatorLogic.TemplateName = TemplateName;
                                }
                                if (LogoName != null)
                                {
                                    string[] splitted     = LogoName.Split('\\');
                                    LogoName              = splitted[splitted.Length - 1];
                                    creatorLogic.LogoName = LogoName;
                                }

                                if (Hashtag_1.Length > 0)
                                {
                                    creatorLogic.HashtagforDrawing1 = "#" + Hashtag_1;
                                }
                                if (Hashtag_2.Length > 0)
                                {
                                    creatorLogic.HashtagforDrawing2 = "#" + Hashtag_2;
                                }

                                creatorLogic.Username = files[files.Count - 1];

                                var imgRs1 = creatorLogic.ResizeImage(640, Environment.CurrentDirectory + @"\Photos\" + files[0]);

                                string oldFile0 = files[0];

                                files[0] = oldFile0.Replace(".jpg", "lp.jpg");

                                imgRs1.Save(Environment.CurrentDirectory + @"\Photos\" + files[0]); imgRs1.Dispose();

                                File.Delete(@"Photos\" + oldFile0);

                                string photoName = creatorLogic.CreatePhoto(files[0]);
                                creatorLogic.AddLogo(photoName);

                                File.Delete(@"Photos\" + files[0]);

                                var img             = creatorLogic.ResizeImage(610, photoName);
                                string newPhotoName = photoName.Replace(".jpg", "sp.jpg");
                                img.Save(newPhotoName);
                                img.Dispose();
                                File.Delete(photoName);

                                PrintCl print = new PrintCl(Environment.CurrentDirectory + "\\" + newPhotoName);
                                try { print.PrintImage(); SuccessPrint++; }
                                catch (Exception ex)
                                { Debug.WriteLine(ex.Message + "\n" + ex.StackTrace); UnsuccessPrints++; }
                                File.Delete(newPhotoName);
                            }
                            WaitingPrint--;
                        }
                        tempPos = -1;
                    }
                    IsPrintAll = false;
                    tempPos++;
                    Thread.Sleep(30000);
                }
            });
        }