Beispiel #1
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Beispiel #2
0
        private async void uploadButton_Click(object sender, EventArgs e)
        {
#if USE_JSON
            Chevereto imgUploader;
            try
            {
                var uploader = userMenuStrip.Items.Cast <ToolStripMenuItem>().First(item => item.Checked).Tag as CheveretoUploader;
                imgUploader = new Chevereto(uploader);
            }
            catch (InvalidOperationException)
            {
                MessageBox.Show("请在配置文件中设定默认账号或手动选中账号", Utility.GetHelplessEmotion());
                return;
            }
#elif USE_LB
            var       lb          = new CheveretoUploader("http://img.2222.moe/littlebakas/1/upload/", "0f563a641610160a32a1f87d364269f0");
            Chevereto imgUploader = new Chevereto(lb);
#else
            var       vcb_s       = new CheveretoUploader("http://img.2222.moe/api/1/upload", "0f653a641610160a23a1f87d364926f9");
            Chevereto imgUploader = new Chevereto(vcb_s);
#endif
            int  count = 0;
            bool flag  = false;
            foreach (Frame f in FList)
            {
                flag = await Task.Run(() =>
                {
                    if (!imgUploader.UploadImage(f.SrcName, Utility.CurrentDir + f.SrcName))
                    {
                        return(false);
                    }
                    if (!imgUploader.UploadImage(f.RipName, Utility.CurrentDir + f.RipName))
                    {
                        return(false);
                    }
                    return(imgUploader.UploadImage(f.FrameId + "s.png", Utility.CurrentDir + f.FrameId + "s.png"));
                });

                if (!flag)
                {
                    break;
                }
                count++;
                InfoBoard.AppendText($"已经上传完第 {count}/{FList.Count} 组截图。\n");
                Application.DoEvents();
            }
            if (!flag)
            {
                MessageBox.Show("自己登录图床把上传一半的删了,然后手动上传所有图吧。同目录下的截图代码应该还可以用。", "上传跪了" + Utility.GetHelplessEmotion());
            }
            GenerateCode(flag);
            uploadButton.Enabled = false;
        }
Beispiel #3
0
        private async void uploadButton_Click(object sender, EventArgs e)
        {
#if USE_JSON
            Chevereto imgUploader;
            try
            {
                var uploader = userMenuStrip.Items.Cast <ToolStripMenuItem>().First(item => item.Checked).Tag as CheveretoUploader;
                imgUploader = new Chevereto(uploader);
            }
            catch (InvalidOperationException)
            {
                MessageBox.Show("请在配置文件中设定默认账号或手动选中账号", Utility.GetHelplessEmotion());
                return;
            }
#elif USE_LB
            var       lb          = new CheveretoUploader("http://img.2222.moe/littlebakas/1/upload/", "0f563a641610160a32a1f87d364269f0");
            Chevereto imgUploader = new Chevereto(lb);
#else
            var       vcb_s       = new CheveretoUploader("http://img.2222.moe/api/1/upload", "0f653a641610160a23a1f87d364926f9");
            Chevereto imgUploader = new Chevereto(vcb_s);
#endif
            InfoBoard.AppendText($"开始上传,耐心等一会儿......\n");
            Application.DoEvents();
            int  count = 0;
            bool flag  = false;
            foreach (Frame f in FList)
            {
                flag = await Task.Run(() =>
                {
                    if (!imgUploader.UploadImage(f.SrcName, Path.Combine(Utility.CurrentDir, f.SrcName)))
                    {
                        return(false);
                    }
                    if (!imgUploader.UploadImage(f.RipName, Path.Combine(Utility.CurrentDir, f.RipName)))
                    {
                        return(false);
                    }
                    return(imgUploader.UploadImage(f.FrameId + "s.png", Path.Combine(Utility.CurrentDir, f.FrameId + "s.png")));
                });

                if (!flag)
                {
                    break;
                }
                count++;
                InfoBoard.AppendText($"已经上传完第 {count}/{FList.Count} 组截图。\n");
                Application.DoEvents();
            }
            if (!flag)
            {
                MessageBox.Show("自己登录图床把上传一半的删了,然后手动上传所有图吧。同目录下的截图代码应该还可以用。", "上传跪了" + Utility.GetHelplessEmotion());
            }

            try
            {
                var urltxt = Path.Combine(Utility.CurrentDir, "url.txt");
                using (var file = new StreamWriter(urltxt, false))
                {
                    file.WriteLine(GenerateHTML());
                    file.WriteLine();
                    file.WriteLine(GenerateBbcode());
                    file.WriteLine();
                    file.WriteLine(GenerateMarkdown());
                }
                if (flag)
                {
                    MessageBox.Show("截图代码已经写在url.txt里", "去丢发布组吧" + Utility.GetHappyEmotion());
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show($"保存文件出现异常: {exception.Message}\n调用栈:{exception.StackTrace}");
            }
            uploadButton.Enabled = false;
        }
Beispiel #4
0
 void Start()
 {
     infoBoard = GameObject.FindWithTag("InfoBoard").GetComponent <InfoBoard>();
     egHub     = GameObject.FindWithTag("EnemyGeneratorHub").GetComponent <EnemyGeneratorHub>();
 }
Beispiel #5
0
        public void TestMethod1()
        {
            using (MyDB mydb = new MyDB())
            {
                Info info = new Info
                {
                    ID         = Guid.NewGuid().ToString(),
                    Title      = "这是一个测试",
                    Content    = "Content",
                    Creator    = mydb.Users.FirstOrDefault(u => u.Code == "chw"),
                    CreateDate = DateTime.Now,
                    SendDate   = DateTime.Now,
                    SendTypes  = "SMS,Msg,Email",
                    InfoFiles  = new InfoFile[]
                    {
                        new InfoFile
                        {
                            ID         = Guid.NewGuid().ToString(),
                            FileName   = "WWW.doc",
                            UploadDate = DateTime.Now,
                            File       = new File
                            {
                                ID         = Guid.NewGuid().ToString(),
                                Name       = "XXX",
                                Suffix     = "doc",
                                CreateDate = DateTime.Now,
                                Creator    = mydb.Users.FirstOrDefault(u => u.Code == "chw"),
                                UploadPath = "~/uploads"
                            }
                        },
                        new InfoFile
                        {
                            ID         = Guid.NewGuid().ToString(),
                            FileName   = "XXX.jpg",
                            UploadDate = DateTime.Now,
                            File       = new File
                            {
                                ID         = Guid.NewGuid().ToString(),
                                Name       = "XXX",
                                Suffix     = "jpg",
                                CreateDate = DateTime.Now,
                                Creator    = mydb.Users.FirstOrDefault(u => u.Code == "chw"),
                                UploadPath = "~/uploads"
                            }
                        }
                    },
                    Receivers = new InfoInbox[]
                    {
                        new InfoInbox
                        {
                            ID           = Guid.NewGuid().ToString(),
                            Receiver     = mydb.Users.FirstOrDefault(u => u.Code == "chw"),
                            ReadDate     = DateTime.Now,
                            ReceiveTypes = "SMS,Msg,Email"
                        },
                        new InfoInbox
                        {
                            ID           = Guid.NewGuid().ToString(),
                            Receiver     = mydb.Users.FirstOrDefault(u => u.Code == "lilin"),
                            ReadDate     = DateTime.Now,
                            ReceiveTypes = "SMS,Msg,Email"
                        },
                    }
                };

                InfoBoard board = new InfoBoard
                {
                    ID            = Guid.NewGuid().ToString(),
                    Name          = "dfadsfa",
                    Administrator = mydb.Users.FirstOrDefault(u => u.Code == "lilin"),
                    CreateDate    = DateTime.Now,
                    Infos         = new [] { info }
                };

                InfoSubscription sub = new InfoSubscription
                {
                    ID         = Guid.NewGuid().ToString(),
                    Owner      = mydb.Users.FirstOrDefault(u => u.Code == "lilin"),
                    Title      = info,
                    Name       = "sdsss",
                    Enable     = true,
                    CreateDate = DateTime.Now
                };

                mydb.Infos.Add(info);
                mydb.InfoBoards.Add(board);
                mydb.InfoSubscriptions.Add(sub);

                mydb.SaveChanges();
            }
        }
        public override void InitState(GameObjectManager[] objectManagerArray, MainGame owner)
        {
            base.InitState(objectManagerArray, owner);
            _map = (Map)objectManagerArray[1].CreateObject(0);
            GlobalVariables.MapCollisionDim = _map.CollisionDim;
            _char = (PlayerCharacter)objectManagerArray[0].CreateObject(0);
            _char.SetMap(_map);
            _char.StateOwner = this;

            _map.Owner = this;
            _listMonsters = _map.InitMonsterList((MonsterManager)objectManagerArray[2],@"Data\Map\map01\map01_monster.xml");

            _frog = new Fog();
            _frog.Init(owner.Content);
            _frog.SetCharacter(_char);

            _displayMessageLayer = new DisplayMessageLayer();

            //Phần ???---------------------------------------------------------------------------
            _listPortral = _map.InitPortralList((PortralManager)objectManagerArray[4], @"Data\Map\map01\map01_portral.xml");
            _listObstacle = _map.InitObstacle((MapObstacleManager)objectManagerArray[5], @"Data\Map\map01\map01_obstacle.xml");
            _objectManagerArray = objectManagerArray;
            _listToDraw = new List<VisibleGameEntity>();

            _char.InitSkill();

            //Phần healthbar--------------------------------------------------------------------
            _healthBar = new HealthBar();
            _healthBar.SetCharacter(_char);

            List<GameObjectManager> _resourcesForHealthbar = new List<GameObjectManager>();
            _resourcesForHealthbar.Add(objectManagerArray[8]);
            _resourcesForHealthbar.Add(objectManagerArray[9]);
            _resourcesForHealthbar.Add(objectManagerArray[10]);
            _resourcesForHealthbar.Add(objectManagerArray[11]);
            _healthBar.GetResources(_resourcesForHealthbar);

            //Phần SkillBoard------------------------------------------------------------------
            _skillBoard = new SkillBoard();
            _skillBoard.SetCharacter(_char);

            List<GameObjectManager> _resourcesForSkillBoard = new List<GameObjectManager>();
            _resourcesForSkillBoard.Add(objectManagerArray[8]);
            _resourcesForSkillBoard.Add(objectManagerArray[10]);
            _resourcesForSkillBoard.Add(objectManagerArray[11]);
            _skillBoard.GetResources(_resourcesForSkillBoard);

            //Phần Left-hand selection frame
            _lhSkillSelectionFrame = new LHSkillSelectionFrame();
            _lhSkillSelectionFrame.SetCharacter(_char);

            List<GameObjectManager> _resourceForLHSSelectionFrame = new List<GameObjectManager>();
            _resourceForLHSSelectionFrame.Add(_objectManagerArray[8]);
            _resourceForLHSSelectionFrame.Add(_objectManagerArray[10]);
            _lhSkillSelectionFrame.GetResources(_resourceForLHSSelectionFrame);

            //Phần Right-hand selection frame
            _rhSkillSelectionFrame = new RHSkillSelectionFrame();
            _rhSkillSelectionFrame.SetCharacter(_char);
            _rhSkillSelectionFrame.GetResources(_resourceForLHSSelectionFrame);

            //Phần subMenu
            _subMenu = new SubMenu();
            List<GameObjectManager> _resourceForSubMenu = new List<GameObjectManager>();
            _resourceForSubMenu.Add(_objectManagerArray[8]);
            _resourceForSubMenu.Add(_objectManagerArray[10]);
            _subMenu.GetResources(_resourceForSubMenu);
            _subMenu.GetStateOwner(this);

            //Phần infoBoard
            _infoBoard = new InfoBoard();
            _infoBoard.SetCharacter(_char);
            List<GameObjectManager> _resourceForInfo = new List<GameObjectManager>();
            _resourceForInfo.Add(_objectManagerArray[8]);
            _resourceForInfo.Add(_objectManagerArray[10]);
            _resourceForInfo.Add(_objectManagerArray[11]);
            _infoBoard.GetResources(_resourceForInfo);
        }