public static void SetRollingType(noticeType type)
 {
     gblType   = type;
     moveNotCD = true;
     //lastCDTime = 0;
     lastTime = 0;
 }
    private int NoticeMaxNum(noticeType type)
    {
        int num = 0;

        switch (type)
        {
        case noticeType.NONE:
            num = 40;
            break;

        case noticeType.HELP:
            num = NotiveMaxNumCell(noticeType.HELP);
            break;

        case noticeType.SYSTEM:
            num = NotiveMaxNumCell(noticeType.SYSTEM);
            break;

        case noticeType.RAIDER:
            num = NotiveMaxNumCell(noticeType.RAIDER);
            break;

        case noticeType.INFO:
            num = NotiveMaxNumCell(noticeType.INFO);
            break;

        default:
            return(0);
        }
        return(num);
    }
    private int RandomNoticeWitnType(noticeType type = noticeType.NONE)
    {
        int n4;
        int n1;
        int n;

        switch (type)
        {
        case noticeType.NONE: {
            int max = NoticeMaxNum(noticeType.NONE);
            n4 = Random.Range((int)noticeType.HELP, (int)noticeType.INFO);
            n1 = Random.Range(0, max);
            n  = n4 * 1000 + n1;

            if (n != noticeID1 && n != noticeID2 && TableManager.GetRollingnoticeByID(n) != null)
            {
                return(n);
            }
            else
            {
                return(RandomNoticeWitnType());
            }
        }

        case noticeType.HELP: {
            return(RandomCell(noticeType.HELP));
        }
        break;

        case noticeType.SYSTEM: {
            return(RandomCell(noticeType.SYSTEM));
        }
        break;

        case noticeType.RAIDER: {
            return(RandomCell(noticeType.RAIDER));
        }
        break;

        case noticeType.INFO: {
            return(RandomCell(noticeType.INFO));
        }
        break;

        default:
            return(0);
        }
        return(0);
    }
    private int NotiveMaxNumCell(noticeType type)
    {
        int num     = 0;
        int typenum = ((int)type - 1);

        foreach (DictionaryEntry tr in TableManager.GetRollingnotice())
        {
            Tab_Rollingnotice tbr = tr.Value as Tab_Rollingnotice;
            if (tbr.Type == typenum)
            {
                num++;
            }
        }
        return(num);
    }
    private int RandomCell(noticeType type)
    {
        int max = NoticeMaxNum(type);
        int n1  = Random.Range(0, max);
        int n   = (int)type * 1000 + n1;

        if (n != noticeID1 && n != noticeID2 && TableManager.GetRollingnoticeByID(n) != null)
        {
            return(n);
        }
        else if (max == 1)
        {
            return(n);
        }
        else
        {
            return(RandomCell(type));
        }
    }