예제 #1
0
                } // end UISelectRolePanel

                public void DoBeforeEntering()
                {
                    gameObject = ObjectTool.InstantiateGo("SelectRolePanelUI", ResourcesTool.LoadPrefabUI(id),
                                                          SceneManager.mainCanvas.rectTransform);
                    rectTransform           = gameObject.GetComponent <RectTransform>();
                    rectTransform.sizeDelta = SceneManager.mainCanvas.sizeDelta;
                    roleindex       = 0;
                    createIndex     = -1;
                    selectedindex   = -1;
                    roleDict        = new Dictionary <int, string[]>();
                    t_roleName      = rectTransform.Find("RoleName").GetComponent <Text>();
                    t_roleName.text = "";
                    display         = rectTransform.Find("DisplayRaw").gameObject.AddComponent <UIDisplayRaw>();
                    string prefix = "RoleList/Role_";

                    for (int i = 0; i < 3; i++)
                    {
                        int index = i;
                        roleDict.Add(index, SqliteManager.GetRoleInfoWithID(GameManager.playerInfo.username, index));
                        rectTransform.Find(prefix + i).gameObject.AddComponent <UIButtonNormal>().AddListener(delegate() { OnSwitchRole(index); });
                        if (null != roleDict[index])
                        {
                            rectTransform.Find(prefix + i + "/Text").GetComponent <Text>().text = roleDict[index][0];
                        }
                        // end if
                    } // end for
                    rectTransform.Find("DeleteRoleBtn").gameObject.AddComponent <UIButtonNormal>().AddListener(OnClickDeleteRoleBtn);
                    rectTransform.Find("StartGameBtn").gameObject.AddComponent <UIButtonNormal>().AddListener(OnClickStartGameBtn);
                    InitialSwitchRole();
                } // end DoBeforeEntering
예제 #2
0
        public static IEnumerable <string> GetSortedMangas()
        {
            SortedSet <string> mangas = new();

            SqliteManager.Get().GetMangas().Split('\n').ForEach(m => mangas.Add(m));
            return(mangas);
        }
    private void Awake()
    {
        _sqliteManager = SqliteManager.Instance;
        _sqliteManager.OpenDBFile(SqlConfig.myDB + "1");

        _sqliteManager.CreateTable(tableName, SqlConfig.testTableBlock);
    }
예제 #4
0
            }         // end IsFull

            public Pack(string username, int roleindex, string packType)
            {
                this.packType  = packType;
                this.username  = username;
                this.roleindex = roleindex;
                idList         = new string[ConstConfig.GRID_COUNT];
                countList      = new int[ConstConfig.GRID_COUNT];
                Dictionary <int, string[]> dict;

                SqliteManager.GetPackInfoWithID(username, roleindex, packType, out dict);
                for (int i = 0; i < ConstConfig.GRID_COUNT; i++)
                {
                    int count = 0;
                    if (!dict.ContainsKey(i))
                    {
                        idList[i] = "0";
                        continue;
                    } // end if
                    idList[i] = dict[i][0];
                    if (Configs.itemConfig.GetItemType(idList[i]) != packType)
                    {
                        idList[i] = "0";
                    }
                    // end if
                    if (int.TryParse(dict[i][1], out count))
                    {
                        countList[i] = count;
                    }
                    // end if
                } // end for
            }     // end Pack
예제 #5
0
            } // end ExchangeGridInfoWithGid

            public void ArrangePack()
            {
                Dictionary <int, string[]> dict = new Dictionary <int, string[]>();

                SqliteManager.GetArrangePackInfo(username, roleindex, packType, ref dict);

                for (int i = 0; i < ConstConfig.GRID_COUNT; i++)
                {
                    int count = 0;

                    if (dict.ContainsKey(i))
                    {
                        idList[i] = dict[i][0];

                        if (int.TryParse(dict[i][1], out count))
                        {
                            countList[i] = count;
                        }
                        else
                        {
                            countList[i] = 0;
                        } // end if
                    }
                    else
                    {
                        idList[i]    = "0";
                        countList[i] = 0;
                    } // end if
                    WriteGridInfo(i, idList[i], countList[i]);
                }     // end for
            }         // end ArrangePack
예제 #6
0
        public override async Task Invoke(IUserMessage message)
        {
            string msg = "Il faut mettre l'id ou la mention de la personne. Ex : " + Name + " 227490882033680384";

            try {
                var   userId  = message.Content.Split(' ')[1];
                ulong userId_ = System.Convert.ToUInt64(userId.OnlyKeepDigits());

                if (userId_ == DataManager.master_id)
                {
                    msg = "Bien essayé, mais non. " + Utilities.EmoteManager.Smirk;
                    await message.Channel.SendMessageAsync(msg);

                    return;
                }

                if (!SqliteManager.Get().GetBannedList().Contains(userId_))
                {
                    SqliteManager.Get().AddBan(userId_);
                    msg = $"L'utilisateur <@{userId_}> a bien été banni.";
                }
                else
                {
                    msg = "Cet utilisateur est déjà banni.";
                }
            }
            catch (System.Exception e) {
                e.Display(Name);
            }

            await message.Channel.SendMessageAsync(msg);
        }
예제 #7
0
                } // end PackCoin

                public bool SpendCoin(int count) {
                    if (count < 0 || coin < count) return false;
                    // end if
                    coin = coin - count;
                    SqliteManager.SetRoleCoinWithID(username, roleindex, coin);
                    return true;
                } // end SpendCoin
예제 #8
0
        public override async Task Invoke(IUserMessage message)
        {
            IUser  author = message.Author;
            string result = SqliteManager.Get().AddUser(author.Id.ToString(), author.Username, author.Username);

            await message.Channel.SendMessageAsync(result);
        }
예제 #9
0
 public NotifyViewModel(Page page)
 {
     this.page     = page;
     service       = new BoshokuService();
     categoryList  = LocalCategory.getListMain();
     sqliteManager = new SqliteManager();
 }
예제 #10
0
        private string AddMangaJapscan(string manga)
        {
            string msg = string.Empty;

            try {
                if (MangasUtils.GetMangaIdByName(manga) != null)
                {
                    return("Ce manga est déjà dans la liste poto ! :)");
                }

                string site = MangasUtils.JAPSCAN;
                string link = site + "lecture-en-ligne/" + manga + "/";

                string crawlerResult = new Crawler.Crawler(link).Crawl();

                if (crawlerResult.Contains("Cette page n'existe pas ou plus"))
                {
                    throw new WebException();
                }

                //Si on arrive ici sans exception c'est que c'est bon
                SqliteManager.Get().AddManga(manga);
                msg = $"Manga '{manga}' ajouté à la liste.";
            }
            catch (Exception e) {
                if (e is ArgumentOutOfRangeException || e is WebException)
                {
                    msg = "Ce manga n'existe pas ou le site ne le possède pas. Le nom doit être de la forme : one-piece (minuscules séparées par un tiret)";
                }
            }

            return(msg);
        }
예제 #11
0
        public override async Task Invoke(IUserMessage message)
        {
            string msgError = "La commande a mal été écrite.";

            string msg;

            try {
                string mangaName = message.Content.ToLower().Split(' ')[1];
                string manga     = MangasUtils.GetMangaIdByName(mangaName);

                if (manga == null)
                {
                    msg = $"Le manga '{mangaName}' n'était pas dans la liste.";
                }
                else
                {
                    SqliteManager.Get().RemoveManga(mangaName);
                    msg = $"Le manga '{mangaName}' a bien été supprimé de la liste.";
                }
            }
            catch (Exception) {
                msg = msgError;
            }

            await message.Channel.SendMessagesAsync(msg);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Main);

            Button add = FindViewById <Button>(Resource.Id.main_btn_add);
            Button del = FindViewById <Button>(Resource.Id.main_btn_del);
            Button que = FindViewById <Button>(Resource.Id.main_btn_que);

            add.Click += (s, e) =>
            {
                Intent dialog = new Intent(this, typeof(AddActivity));
                StartActivity(dialog);
            };
            del.Click += (s, e) =>
            {
                Intent dialog = new Intent(this, typeof(DeleteActivity));
                StartActivity(dialog);
            };
            que.Click += (s, e) =>
            {
                Intent dialog = new Intent(this, typeof(QueryActivity));
                StartActivity(dialog);
            };

            SqliteManager <Person> sqlite = new SqliteManager <Person>();

            sqlite.CreateTable();
        }
예제 #13
0
        public async Task Guild_Message_Received(SocketUserMessage message)
        {
            if (message.Author.Id == DataManager.master_id || message.Author.Id == Users.Bot.Id || SqliteManager.Get().GetBannedList().Contains(message.Author.Id))
            {
                return;
            }

            ulong authorId = message.Author.Id;

            if (DataManager.people_spam.ContainsKey(authorId))
            {
                DataManager.people_spam[authorId]++;
            }
            else
            {
                DataManager.people_spam.Add(authorId, 0);
            }

            foreach (KeyValuePair <ulong, int> kvp in DataManager.people_spam)
            {
                if (kvp.Value > 4)
                {
                    try {
                        SocketUser user = DataManager._client.GetUser(kvp.Key);
                        await message.Channel.SendMessageAsync($"{user.Mention}, a été banni pour avoir trop spam.");

                        SqliteManager.Get().AddBan(kvp.Key);
                    }
                    catch (System.Exception e) {
                        e.Display("BanListenerMessageReceived");
                    }
                }
            }
        }
예제 #14
0
 private IEnumerator Start() {
     InstanceMgr.Init();
     SqliteManager.Init();
     Application.targetFrameRate = 30;
     Resources.Load<ShaderVariantCollection>("Shader/ShaderVariants").WarmUp();
     yield return null;
     LoaderScene.LoadNextLevel(new LoginScene());
 } // end Start
예제 #15
0
        public App()
        {
            InitializeComponent();
            //CachedImageRenderer.Init();

            //MainPage = new NavigationPage(new ControlPage()) { BarTextColor = Color.White };
            //nativeMainPage();

            //MainPage = new DrawerPage();
            if (!SaveUserData.userIntro)
            {
                MainPage = new IntroPage();
            }
            else if (!String.IsNullOrEmpty(SaveUserData.userKey))
            {
                MainPage = new NavigationPage(new AppControlPage());
            }
            else
            {
                MainPage = new NavigationPage(new LoginPage())
                {
                    BarTextColor = Color.White
                }
            };

            //android için splash page geçişi
            //SaveUserData.userBadge = 2;
            sqliteConnection = new SqliteManager();
            Connectivity.ConnectivityChanged += Connectivity_ConnectivityChanged;
            OneSignal.Current.StartInit("URL_ONESIGNAL_KEY")
            .HandleNotificationReceived(HandleNotificationReceived)
            .HandleNotificationOpened(HandleNotificationOpened)
            .InFocusDisplaying(Com.OneSignal.Abstractions.OSInFocusDisplayOption.Notification)
            .EndInit();
            //OneSignal.Current.SetSubscription(true);
        }

        void HandleNotificationReceived(Com.OneSignal.Abstractions.OSNotification notification)
        {
            //eğer notifcation gelirse +1 artırıyoruz
            //SaveUserData.userBadge += 1;

            MessagingCenter.Send <App, bool>(this, MCenter.notificationReceived.ToString(), true);
        }

        void Connectivity_ConnectivityChanged(object sender, ConnectivityChangedEventArgs e)
        {
            switch (e.NetworkAccess)
            {
            case NetworkAccess.None:
                this.MainPage.Navigation.PushPopupAsync(new ErrorPopPage(), true);
                break;

            default:
                Console.Write("İnternet connection success");
                break;
            }
        }
예제 #16
0
                } // end Reason

                private void OnUserNameEndEdit(string name) {
                    if (userNameInput.text == "" || userNameInput.text == null) return;
                    // end if
                    if (true == SqliteManager.CheckUserName(userNameInput.text)) {
                        usernameWarningGo.SetActive(true);
                    } else if (usernameWarningGo.activeSelf) {
                        usernameWarningGo.SetActive(false);
                    } // end if
                } // end OnUserNameEndEdit
예제 #17
0
 public override async Task Invoke(IUserMessage message)
 {
     try {
         string result = SqliteManager.Get().AddCrawlSubs(CrawlType.Qwertee, message.Channel.Id);
         await message.Channel.SendMessageAsync(result);
     }
     catch (System.Exception e) {
         e.Display(Name);
     }
 }
예제 #18
0
                } // end OnSwitchRole

                private void OnClickCreateBtn()
                {
                    if (nameInputField.text == "" || nameInputField.text == null)
                    {
                        ObjectTool.InstantiateGo("MessageBoxUI", ResourcesTool.LoadPrefabUI("message_box_ui"),
                                                 SceneManager.mainCanvas.rectTransform).AddComponent <UIMessageBox>().SetMessage("请输入角色名");
                        return;
                    } // end if
                    SqliteManager.CreateRole(GameManager.playerInfo.username, UISelectRolePanel.createIndex, nameInputField.text, roleType);
                    OnClickBackBtn();
                } // end OnClickCreateBtn
예제 #19
0
        internal static void FieldTypeEquals(FieldType type, string connectionString, string tableName, string fieldName)
        {
            var sql        = "SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = @tableName AND COLUMN_NAME = @fieldName";
            var actual     = ExecuteScalar(connectionString, sql, new SqliteParameter("tableName", tableName), new SqliteParameter("fieldName", fieldName)).ToString();
            var actualType = SqliteManager.GetFieldType(actual);

            if (type != actualType)
            {
                throw new Exception("Field '" + fieldName + "' in table '" + tableName + "' is not a " + type + ", its " + actual + " (" + actualType + ")");
            }
        }
예제 #20
0
 //sayfanın navigation bilgisini çekiyoruz
 public NewsFeedViewModel(Page pageNavigation) : base(pageNavigation)
 {
     service       = new BoshokuService();
     new_AnnList   = new ObservableCollection <FirebaseObject <Announcements> >();
     _annList      = new ObservableCollection <FirebaseObject <Announcements> >();
     isEmptyList   = false;
     isPageLoading = true;
     subscribeFastMenu();
     subscribeNotification();
     sqliteManager = new SqliteManager();
     notifyList    = new List <Announcements>();
 }
예제 #21
0
 public MainCharacterPack(string roleType, ICharacterCenter center) {
     username = GameManager.playerInfo.username;
     roleindex = GameManager.playerInfo.roleindex;
     coin = SqliteManager.GetRoleCoinWithID(username, roleindex);
     packDict = new Dictionary<string, IPack>();
     IEquipPack equipPack = new EquipPack(username, roleindex, ConstConfig.EQUIP, roleType, center);
     wearInfo = equipPack;
     packDict.Add(ConstConfig.EQUIP, equipPack);
     packDict.Add(ConstConfig.CONSUME, new Pack(username, roleindex, ConstConfig.CONSUME));
     packDict.Add(ConstConfig.STUFF, new Pack(username, roleindex, ConstConfig.STUFF));
     packDict.Add(ConstConfig.PRINT, new Pack(username, roleindex, ConstConfig.PRINT));
 } // end MainCharacterPack
        public override void OnCreate()
        {
            base.OnCreate();

            var    sqliteFilename = "PortableSqliteDB.db3";
            string libraryPath    = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            var    path           = Path.Combine(libraryPath, sqliteFilename);

            conn = new SQLiteConnection(path);

            Manager = new SqliteManager(conn);
        }
예제 #23
0
        public static List <(string manga, string scan)> GetAllMangasAndScan()
        {
            List <(string manga, string scan)> result = new();

            foreach (string ligne in SqliteManager.Get().GetAllMangasAndScan().Split('\n'))
            {
                var split = ligne.Split(", ");
                result.Add((split[0], split[1]));
            }

            return(result);
        }
예제 #24
0
        private void GenerateMessage(string title, string mangaName, out string subs, out string msg)
        {
            subs = string.Empty;
            string scanValue = "Scan " + title + " => <" + link + ">";

            msg = "Nouveau scan trouvé pour " + mangaName + " : \n\t" + scanValue;
            var users = SqliteManager.Get().GetSubs(mangaName);

            foreach (var user in users)
            {
                subs += "<@" + user + "> ";
            }
        }
예제 #25
0
    public void LoadStep2()
    {
        m_LoadStep = LOAD_STEP._STEP2_LOADING;

        if (DefineBaseManager.inst.GetPlatformType() != (int)PLATFORM_TYPE.PLATFORM_WEB)
        {
            SqliteManagerScript = new SqliteManager();
            SqliteManagerScript.Create();
        }

        DataManagerScript = new DataManager();
        DataManagerScript.Create();

        m_LoadStep = LOAD_STEP._STEP3;
    }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.QueryLayout);

            TextView res = FindViewById <TextView>(Resource.Id.que_text_res);

            SqliteManager <Person> sqlite = new SqliteManager <Person>();
            var list = sqlite.QueryAll();

            foreach (var item in list)
            {
                res.Text += $"ID:{item.ID}  Name:{item.Name}  Sex:{item.Sex}  Age:{item.Age}\n";
            }
        }
예제 #27
0
 public async Task Message_ReactionAdded(Cacheable <IUserMessage, ulong> cached_message, ISocketMessageChannel channel, SocketReaction reaction)
 {
     if (SqliteManager.Get().GetBannedList().Contains(reaction.User.Value.Id) || reaction.User.Value.Id == Users.Bot.Id)
     {
         return;
     }
     if (channel is SocketGuildChannel)
     {
         await Guild_Message_ReactionAdded(cached_message, channel, reaction);
     }
     else
     {
         await DM_Message_ReactionAdded(cached_message, channel, reaction);
     }
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.DeleteLayout);

            Button   del = FindViewById <Button>(Resource.Id.del_btn_del);
            EditText id  = FindViewById <EditText>(Resource.Id.del_edit_id);

            del.Click += (s, e) =>
            {
                SqliteManager <Person> sqlite = new SqliteManager <Person>();

                sqlite.DbConnection.Execute($"delete from Person where id = '{id.Text}'");
            };
        }
예제 #29
0
            }         // end IsFull

            public EquipPack(string username, int roleindex, string packType, string roleType, ICharacterCenter center)
            {
                this.username  = username;
                this.roleindex = roleindex;
                this.packType  = packType;
                this.roleType  = roleType;
                this.center    = center;
                idList         = new string[ConstConfig.GRID_COUNT];

                #region ******** 初始化背包信息 ********
                Dictionary <int, string[]> idDict;
                SqliteManager.GetPackInfoWithID(username, roleindex, packType, out idDict);
                for (int i = 0; i < ConstConfig.GRID_COUNT; i++)
                {
                    if (!idDict.ContainsKey(i))
                    {
                        idList[i] = "0";
                        continue;
                    } // end if
                    idList[i] = idDict[i][0];
                    if (Configs.itemConfig.GetItemType(idList[i]) != packType)
                    {
                        idList[i] = "0";
                    }
                    // end if
                } // end for
                #endregion

                #region ******** 初始化装备穿戴信息 ********
                Dictionary <string, string> initWear;
                SqliteManager.GetWearInfoWithID(username, roleindex, out initWear);
                wearDict = new Dictionary <string, IEquipInfo>();
                for (int i = 0; i < ConstConfig.EquipTypeList.Length; i++)
                {
                    string type = ConstConfig.EquipTypeList[i];
                    if (initWear.ContainsKey(type))
                    {
                        wearDict[type] = Configs.itemConfig.GetItemInfo(initWear[type]) as IEquipInfo;
                    }
                    else
                    {
                        wearDict[type] = null;
                    } // end if
                }     // end for
                #endregion
            }         // end Pack
 public async Task Guild_Message_Received(SocketUserMessage message)
 {
     if (message.Channel.Id == Channels.Musique.Id)
     {
         string msg;
         if ((msg = message.Content.GetYtLink()) != string.Empty)
         {
             try {
                 SqliteManager.Get().AddMusic(msg);
                 await(message as SocketUserMessage).AddReactionAsync(EmoteManager.CheckMark);
             }
             catch (System.Exception) {
                 await(message as SocketUserMessage).AddReactionAsync(EmoteManager.Guilds.Zawarudo.Aret);
             }
         }
     }
 }