コード例 #1
0
    public void TryReceiveReward(ECopyType copyType, int chapter, int awardIndex)
    {
        if (awardIndex < 0 || awardIndex > 2)
        {
            GTItemHelper.ShowTip("非法AwardIndex" + awardIndex);
            return;
        }
        int rewardState = RaidModule.Instance.GetChapterRewardStateByAwardIndex(chapter, awardIndex);

        switch (rewardState)
        {
        case ERewardState.NOT_RECEIVE:
            GTItemHelper.ShowTip("未达成条件");
            return;

        case ERewardState.HAS_RECEIVE:
            GTItemHelper.ShowTip("奖励已领取");
            return;
        }
        DWorld chapterDB = ReadCfgWorld.GetDataById(chapter);
        DAward awardDB   = ReadCfgAward.GetDataById(chapterDB.Awards[awardIndex]);

        if (GTItemHelper.CheckBagFull(awardDB.MaxDropNum))
        {
            return;
        }

        ReqGetChapterAward req = new ReqGetChapterAward();

        req.CopyType = (int)copyType;
        req.Chapter  = chapter;
        req.Index    = awardIndex;
        NetworkManager.Instance.Send <ReqGetChapterAward>(MessageID.MSG_REQ_GET_CHAPTERAWARD, req);
    }
コード例 #2
0
ファイル: DCopy.cs プロジェクト: zyb2013/GameProject3
    public override void Read(XmlElement element)
    {
        this.Id             = element.GetInt32("Id");
        this.CopyType       = (ECopyType)element.GetInt32("CopyType");
        this.CopyDiffculty  = element.GetInt32("CopyDiffculty");
        this.Name           = element.GetString("Name");
        this.CostActionId   = element.GetInt32("CostActionId");
        this.CostActionNum  = element.GetInt32("CostActionNum");
        this.AwardId        = element.GetInt32("AwardId");
        this.FirstAwardId   = element.GetInt32("FirstAwardId");
        this.DropBoxAwardId = element.GetInt32("DropBoxAwardId");
        this.GetMoneyId     = element.GetInt32("GetMoneyId");
        this.GetMoneyRatio  = element.GetInt32("GetMoneyRatio");
        this.GetExpRatio    = element.GetInt32("GetExpRatio");
        this.BattleTimes    = element.GetInt32("BattleTimes");
        this.UnlockLevel    = element.GetInt32("UnlockLevel");
        this.FightValue     = element.GetString("FightValue");
        this.Desc           = element.GetString("Desc");
        this.Texture        = element.GetString("Texture");
        this.Icon           = element.GetString("Icon");
        this.SceneName      = element.GetString("SceneName");
        this.SceneConfig    = element.GetString("SceneConfig");
        this.SceneMusic     = element.GetString("SceneMusic");
        this.SceneNavMesh   = element.GetString("SceneNavMesh");

        for (int i = 1; i <= 3; i++)
        {
            this.StarValues[i - 1]     = element.GetInt32("StarValue" + i);
            this.StarConditions[i - 1] = (EStarCondition)element.GetInt32("StarCondition" + i);
        }
    }
コード例 #3
0
 public void ShowViewById(ECopyType copyType, int chapter, int copyID)
 {
     mCopyType = copyType;
     mChapter  = chapter;
     mCopyID   = copyID;
     ShowView();
 }
コード例 #4
0
    public bool CheckCopy(ECopyType copyType, int chapter, int copyID)
    {
        int    key = (int)copyType;
        DWorld db  = ReadCfgWorld.GetDataById(chapter);

        if (DataDBSRaid.ContainsKey(key))
        {
            XRaid raid = DataDBSRaid.GetDataById(key);
            if (chapter > raid.MaxChapter)
            {
                if (chapter != raid.MaxChapter + 1)
                {
                    GTItemHelper.ShowTip(string.Format("章节超出限制:{0}/{1}", chapter, raid.MaxChapter));
                    return(false);
                }
                if (copyID != db.Copys[0])
                {
                    GTItemHelper.ShowTip("非法CopyID" + copyID);
                    return(false);
                }
            }
            else if (chapter == raid.MaxChapter)
            {
                if (copyID > raid.MaxCopyId + 1)
                {
                    GTItemHelper.ShowTip("非法CopyID" + copyID);
                    return(false);
                }
            }
        }
        return(true);
    }
コード例 #5
0
ファイル: RaidModule.cs プロジェクト: wtrd1234/GameProject3
    public int GetMaxCopyIdByCopyType(ECopyType copyType)
    {
        int   key  = (int)copyType;
        XRaid raid = DataDBSRaid.GetDataById(key);

        return(raid == null ? 0 : raid.MaxCopyId);
    }
コード例 #6
0
ファイル: RaidModule.cs プロジェクト: wtrd1234/GameProject3
    public int GetMaxChapterByCopyType(ECopyType copyType)
    {
        int   key  = (int)copyType;
        XRaid raid = DataDBSRaid.GetDataById(key);

        return(raid == null ? DWorld.WORLD_ST_CHAPTER_ID : raid.MaxChapter);
    }
コード例 #7
0
    public override void Read(XmlElement element)
    {
        this.Id       = element.GetInt32("Id");
        this.Name     = element.GetString("Name");
        this.Icon     = element.GetString("Icon");
        this.Map      = element.GetString("Map");
        this.CopyType = (ECopyType)element.GetInt32("Type");
        this.Desc     = element.GetString("Desc");

        int stCopyId = element.GetInt32("StCopyId");
        int edCopyId = element.GetInt32("EdCopyId");
        int copyNum  = edCopyId - stCopyId + 1;

        this.Copys        = new int[copyNum];
        this.CopyPosArray = new Vector2[copyNum];
        this.Stars        = new int[3];
        this.Awards       = new int[3];

        for (int i = stCopyId; i <= edCopyId; i++)
        {
            int index = i - stCopyId;
            this.Copys[index] = i;
            string field = element.GetString("Pos" + (index + 1));
            this.CopyPosArray[index] = field.ToVector2();
        }
        for (int i = 0; i < 3; i++)
        {
            string s1 = "Star" + (i + 1);
            string s2 = "AwardId" + (i + 1);
            this.Stars[i]  = element.GetInt32(s1);
            this.Awards[i] = element.GetInt32(s2);
        }
    }
コード例 #8
0
ファイル: GTLauncher.cs プロジェクト: zyb2013/GameProject3
 public void ChangeState(ECopyType state, ICommand ev)
 {
     if (CurrCopyType == state)
     {
         return;
     }
     this.mStateMachine.GetState(state).SetCommand(ev);
     this.mStateMachine.ChangeState(state);
     this.CurrCopyType  = state;
     this.CurrSceneName = SceneManager.GetActiveScene().name;
     this.CurScene      = (IScene)this.mStateMachine.GetState(state);
 }
コード例 #9
0
ファイル: GTLauncher.cs プロジェクト: zyb2013/GameProject3
    public void LoadScene(int sceneId, Callback finishCallback = null)
    {
        DCopy db = ReadCfgCopy.GetDataById(sceneId);

        this.NextCopyType = db.CopyType;
        CommandLoadScene cmd = new CommandLoadScene();

        cmd.SceneID = sceneId;
        SceneLoading s = (SceneLoading)mStateMachine.GetState(ECopyType.TYPE_LOAD);

        s.mCallback = finishCallback;
        ChangeState(ECopyType.TYPE_LOAD, cmd);
    }
コード例 #10
0
    public void TryPassCopy(ECopyType copyType, int chapter, int copyID, int starNum)
    {
        if (starNum < 0 || starNum > 3)
        {
            GTItemHelper.ShowTip("非法StarNum" + starNum);
            return;
        }
        if (CheckCopy(copyType, chapter, copyID) == false)
        {
            return;
        }
        ReqPassCopy req = new ReqPassCopy();

        req.CopyType = (int)copyType;
        req.CopyID   = copyID;
        req.Chapter  = chapter;
        req.StarNum  = starNum;
        NetworkManager.Instance.Send <ReqPassCopy>(MessageID.MSG_REQ_PASSCOPY, req);
    }
コード例 #11
0
    public void TryBattleCheck(ECopyType copyType, int chapter, int copyID)
    {
        if (CheckCopy(copyType, chapter, copyID) == false)
        {
            return;
        }
        DCopy copyDB = ReadCfgCopy.GetDataById(copyID);

        if (GTItemHelper.CheckItemEnongh(copyDB.CostActionId, copyDB.CostActionNum) == false)
        {
            return;
        }


        ReqBattleCheck req = new ReqBattleCheck();

        req.CopyType = (int)copyType;
        req.CopyID   = copyID;
        req.Chapter  = chapter;
        NetworkManager.Instance.Send <ReqBattleCheck>(MessageID.MSG_REQ_BATTLE_CHECK, req);
    }
コード例 #12
0
ファイル: RaidModule.cs プロジェクト: wtrd1234/GameProject3
    public int GetMaxCanEnterChapter(ECopyType copyType)
    {
        int key     = (int)copyType;
        int chapter = 0;

        if (DataDBSRaid.ContainsKey(key))
        {
            XRaid  raid      = DataDBSRaid.GetDataById(key);
            DWorld chapterDB = ReadCfgWorld.GetDataById(raid.MaxChapter);
            if (chapterDB.Copys[chapterDB.Copys.Length - 1] == raid.MaxCopyId)
            {
                chapter = GetNextChapter(raid.MaxChapter);
            }
            else
            {
                chapter = raid.MaxChapter;
            }
        }
        else
        {
            chapter = DWorld.WORLD_ST_CHAPTER_ID;
        }
        return(chapter);
    }
コード例 #13
0
ファイル: RaidModule.cs プロジェクト: wtrd1234/GameProject3
    public int GetMaxCanEnterCopyIndex(ECopyType copyType, int chapterID)
    {
        int    maxCopyID  = GetMaxCopyIdByCopyType(copyType);
        int    maxChapter = GetMaxChapterByCopyType(copyType);
        DWorld db         = ReadCfgWorld.GetDataById(chapterID);

        if (maxChapter == 0 && chapterID == DWorld.WORLD_ST_CHAPTER_ID)
        {
            return(1);
        }
        if (maxChapter > chapterID)
        {
            return(db.Copys.Length);
        }
        if (maxChapter == chapterID)
        {
            if (maxCopyID >= 0)
            {
                int index = 1;
                for (int i = 0; i < db.Copys.Length; i++)
                {
                    if (db.Copys[i] <= maxCopyID)
                    {
                        index++;
                    }
                    else
                    {
                        break;
                    }
                }
                index = index > db.Copys.Length ? db.Copys.Length : index;
                return(index);
            }
        }
        return(0);
    }