コード例 #1
0
        public static bool UpdateDailyActiveFlag(GameClient client, int DailyActiveID)
        {
            int  index = DailyActiveManager.GetCompletedFlagIndex(DailyActiveID);
            bool result;

            if (index < 0)
            {
                result = false;
            }
            else
            {
                List <ulong> lsLong      = Global.GetRoleParamsUlongListFromDB(client, "DailyActiveFlag");
                int          arrPosIndex = index / 64;
                while (arrPosIndex > lsLong.Count - 1)
                {
                    lsLong.Add(0UL);
                }
                int   subIndex = index % 64;
                ulong destLong = lsLong[arrPosIndex];
                ulong flag     = 1UL << subIndex;
                lsLong[arrPosIndex] = (destLong | flag);
                Global.SaveRoleParamsUlongListToDB(client, lsLong, "DailyActiveFlag", true);
                result = true;
            }
            return(result);
        }
コード例 #2
0
        public static bool IsFlagIsTrue(GameClient client, int DailyActiveID, bool forAward = false)
        {
            int  index = DailyActiveManager.GetCompletedFlagIndex(DailyActiveID);
            bool result;

            if (index < 0)
            {
                result = false;
            }
            else
            {
                if (forAward)
                {
                    index++;
                }
                List <ulong> lsLong = Global.GetRoleParamsUlongListFromDB(client, "DailyActiveFlag");
                if (lsLong.Count <= 0)
                {
                    result = false;
                }
                else
                {
                    int arrPosIndex = index / 64;
                    if (arrPosIndex >= lsLong.Count)
                    {
                        result = false;
                    }
                    else
                    {
                        int   subIndex = index % 64;
                        ulong destLong = lsLong[arrPosIndex];
                        ulong flag     = 1UL << subIndex;
                        bool  bResult  = (destLong & flag) > 0UL;
                        result = bResult;
                    }
                }
            }
            return(result);
        }