Exemplo n.º 1
0
    //初始化显示的章节
    public void StartChapter(int sceneId)
    {
        //UIManager.Instance.ShowWindowByName("SceneSelect");
        Data_SceneConfig cfg = SceneConfigProvider.Instance.GetSceneConfigById(sceneId);

        if (cfg != null)
        {
            if (cfg.m_Type != c_SinglePVE || cfg.m_Chapter <= 0)
            {
                Debug.LogError("!!!Scene type error,sceneId:" + sceneId);
                return;
            }

            if (cfg.m_SubType == (int)SceneSubTypeEnum.TYPE_ELITE)
            {
                InitChapters(SubSceneType.Master);
                CenterOnChild(cfg.m_Chapter);
                m_TweenSubSceneType = SubSceneType.Master;
            }
            else
            {
                InitChapters(SubSceneType.Common);
                m_TweenSubSceneType = SubSceneType.Common;
                CenterOnChild(cfg.m_Chapter);
            }
            AddTweenOnScene(m_CurrentChapterId, sceneId);
        }
        else
        {
            Debug.Log("Can not get sceneconfig " + sceneId);
        }
    }
Exemplo n.º 2
0
    public bool InitChapterById(int chapterId, int[] chapterInfo, SubSceneType subType, ref bool isNextChapterUnlock)
    {
        isNextChapterUnlock = false;
        if (chapterInfo == null)
        {
            return(true);
        }
        m_ChapterId = chapterId;
        int  index         = 0;
        bool isLockChapter = true;//判断当前关卡是否解锁()

        for (index = 0; index < chapterInfo.Length; ++index)
        {
            if (index < sceneArr.Length && sceneArr[index] != null)
            {
                UIScene sceneScript = sceneArr[index];
                if (sceneScript != null)
                {
                    bool isLock = true;
                    //星级
                    int      grade     = 0;
                    RoleInfo role_info = LobbyClient.Instance.CurrentRole;
                    if (role_info != null)
                    {
                        if (!role_info.SceneInfo.ContainsKey(chapterInfo[index]) && chapterInfo[index] != -1)
                        {
                            //判断这一章是否已经全部打完
                            isNextChapterUnlock = false;
                        }
                        //判断是否已经打过
                        if (role_info.SceneInfo.ContainsKey(chapterInfo[index]))
                        {
                            isLock = false;
                            int id_key = chapterInfo[index];
                            grade = role_info.SceneInfo[id_key];
                        }
                        else if (UICurrentChapter.m_UnLockNextScene == false)
                        {
                            //每次初始化时、应该解锁下一关
                            UICurrentChapter.m_UnLockNextScene = true;
                            isLock = false;
                        }
                    }
                    if (isLock == false)
                    {
                        isLockChapter = false;
                    }
                    if (index == chapterInfo.Length - 1 && isNextChapterUnlock)
                    {
                        if (chapterInfo[index] == -1)
                        {
                            UICurrentChapter.m_UnLockNextScene = false;
                        }
                    }
                    sceneScript.InitScene(chapterInfo[index], isLock, subType, grade);
                }
            }
        }
        return(isLockChapter);
    }
Exemplo n.º 3
0
    //获取各章节的信息
    private bool GetChapterInfo(int chapterIndex, int[] chapterInfo, SubSceneType subType)
    {
        if (chapterInfo == null)
        {
            return(false);
        }
        //配表需要从第一章开始
        bool     hasChapter = false;
        RoleInfo role       = LobbyClient.Instance.CurrentRole;
        int      arrLength  = chapterInfo.Length;
        MyDictionary <int, object> allSceneConfig = SceneConfigProvider.Instance.GetAllSceneConfig();

        foreach (Data_SceneConfig sceneCfg in allSceneConfig.Values)
        {
            if (sceneCfg != null && sceneCfg.m_Type == c_SinglePVE && sceneCfg.m_SubType == (int)subType && sceneCfg.m_RelatedMainCity == role.CitySceneId)
            {
                if (sceneCfg.m_Order < arrLength && sceneCfg.m_Order >= 0)
                {
                    chapterInfo[sceneCfg.m_Order] = sceneCfg.GetId();
                    hasChapter = true;
                }
            }
        }
        return(hasChapter);
    }
Exemplo n.º 4
0
    public void InitScene(int sceneId, bool isLock, SubSceneType subType, int grade)
    {
        if (sceneId == -1)
        {
            NGUITools.SetActive(this.gameObject, false);
        }
        else
        {
            if (!NGUITools.GetActive(this.gameObject))
            {
                NGUITools.SetActive(this.gameObject, true);
            }
        }
        InitStarArr();
        m_SceneId    = sceneId;
        m_SceneGrade = grade;
        m_SubType    = subType;
        NewLockScene(isLock, sceneId);
        LockScene(isLock);
        int bossId = -1;
        Data_SceneConfig sceneCfg = SceneConfigProvider.Instance.GetSceneConfigById(sceneId);

        if (null != sceneCfg)
        {
            SetSceneName((sceneCfg.m_Order + 1).ToString());
            bossId = sceneCfg.m_BossLinkId;
        }
        ShowSceneMode(subType, grade, bossId);
    }
Exemplo n.º 5
0
 public void OnReturnBtnClick()
 {
     DelTweenOnScene(m_TweenChapter, m_TweenScene);
     m_TweenScene        = -1;
     m_TweenChapter      = -1;
     m_TweenSubSceneType = SubSceneType.UnKnown;
     UIManager.Instance.HideWindowByName("SceneSelect");
 }
Exemplo n.º 6
0
 public TeleportInfoComponent(SceneType inType, SubSceneType curSubScene, SubSceneType nextSubScene, int inPoint, float inTime, float inFadeTime)
 {
     sceneType        = inType;
     curSubSceneType  = curSubScene;
     nextSubSceneType = nextSubScene;
     pointID          = inPoint;
     teleportTime     = inTime;
     fadeInOutTime    = inFadeTime;
 }
Exemplo n.º 7
0
 //设置与关闭精英模式
 public void ShowSceneMode(SubSceneType subType)
 {
     for (int index = 0; index < sceneArr.Length; ++index)
     {
         if (sceneArr[index] != null)
         {
             //sceneArr[index].ShowSceneMode(subType);
         }
     }
 }
Exemplo n.º 8
0
 public TeleportComponent(ref TeleportInfoComponent rhs)
 {
     sceneType           = rhs.sceneType;
     curSubSceneType     = rhs.curSubSceneType;
     nextSubSceneType    = rhs.nextSubSceneType;
     pointID             = rhs.pointID;
     elapsedTeleportTime = 0.0f;
     teleportTime        = rhs.teleportTime;
     fadeInOutTime       = rhs.fadeInOutTime;
 }
Exemplo n.º 9
0
    protected override void OnUpdate()
    {
        if (Utility.playerEntity.Equals(Entity.Null))
        {
            return;
        }

        Entities.ForEach((ref TeleportComponent teleportComp, ref PlayerComponent playerComp, ref Translation pos) => {
            if (EntityManager.HasComponent <FadeInComponent>(Utility.playerEntity) || EntityManager.HasComponent <FadeOutComponent>(Utility.playerEntity))
            {
                return;
            }

            // start
            if (_desiredPos.Equals(float3.zero))
            {
                EntityManager.AddComponentData(Utility.playerEntity, new GamePauseComponent());
                EntityManager.AddComponentData(Utility.playerEntity, new FadeInComponent(teleportComp.fadeInOutTime));
                EntityManager.AddComponentData(Utility.playerEntity, new SubSceneControlComponent());
                EntityManager.AddComponentData(Utility.playerEntity, new SubSceneLoadComponent()
                {
                    type = (int)teleportComp.nextSubSceneType
                });
                _desiredPos = GetTeleportPoint(teleportComp.sceneType, teleportComp.pointID);
            }
            // finish
            else if (pos.Value.Equals(_desiredPos))
            {
                _curSubSceneType = teleportComp.nextSubSceneType;

                EntityManager.AddComponentData(Utility.playerEntity, new GameResumeComponent());
                EntityManager.RemoveComponent <TeleportComponent>(Utility.playerEntity);
                EntityManager.RemoveComponent <SubSceneControlComponent>(Utility.playerEntity);
                playerComp.currentBehaviors ^= BehaviorState.teleport;
                _desiredPos = float3.zero;

                return;
            }

            teleportComp.elapsedTeleportTime += Time.DeltaTime;
            if (teleportComp.elapsedTeleportTime >= teleportComp.teleportTime)
            {
                // player
                pos.Value = _desiredPos;

                EntityManager.AddComponentData(Utility.playerEntity, new CameraSyncComponent(_desiredPos));
                EntityManager.AddComponentData(Utility.playerEntity, new FadeOutComponent(teleportComp.fadeInOutTime));
                EntityManager.AddComponentData(Utility.playerEntity, new SubSceneUnLoadComponent()
                {
                    type = (int)teleportComp.curSubSceneType
                });
            }
        });
    }
Exemplo n.º 10
0
    public void InitSceneIntroduce(int sceneId, int grade, SubSceneType subType)
    {
        try
        {
            NGUITools.SetActive(wipePanel, false);
            NGUITools.SetActive(wipeBtn0.gameObject, false);
            NGUITools.SetActive(wipeBtn1.gameObject, false);
            if (subType == SubSceneType.Common)
            {
                m_SubSceneType = SubSceneType.Common;
                for (int i = 0; i < starArr.Length; ++i)
                {
                    if (starArr[i] != null)
                    {
                        NGUITools.SetActive(starArr[i].gameObject, false);
                    }
                }
                RoleInfo role = LobbyClient.Instance.CurrentRole;
                if (role.SceneInfo.ContainsKey(sceneId))
                {
                    NGUITools.SetActive(wipePanel, true);
                    NGUITools.SetActive(wipeBtn0.gameObject, true);
                    NGUITools.SetActive(wipeBtn1.gameObject, true);
                }
            }
            else
            {
                m_SubSceneType = SubSceneType.Master;
                for (int i = 0; i < starArr.Length; ++i)
                {
                    if (starArr[i] != null)
                    {
                        NGUITools.SetActive(starArr[i].gameObject, true);
                    }
                    if (i < grade)
                    {
                        if (starArr[i] != null)
                        {
                            starArr[i].spriteName = c_BrightStar;
                        }
                    }
                    else
                    {
                        if (starArr[i] != null)
                        {
                            starArr[i].spriteName = c_AshStar;
                        }
                    }
                }
                if (grade >= maxStarNum)
                {
                    NGUITools.SetActive(wipePanel, true);
                    NGUITools.SetActive(wipeBtn0.gameObject, true);
                    NGUITools.SetActive(wipeBtn1.gameObject, true);
                }
            }
            if (uiSceneAward != null)
            {
                uiSceneAward.ShowAwardInfo(sceneId, subType, grade);
            }
            m_SceneId = sceneId;
            Data_SceneConfig sceneCfg  = SceneConfigProvider.Instance.GetSceneConfigById(m_SceneId);
            RoleInfo         role_info = LobbyClient.Instance.CurrentRole;
            if (sceneCfg != null)
            {
                SetName(sceneCfg.m_SceneName);
                SetRecommendFight(sceneCfg.m_RecommendFighting);
                SetCostStatima(sceneCfg.m_CostStamina);
                if (lblSceneIndex != null)
                {
                    lblSceneIndex.text = (1 + sceneCfg.m_Order).ToString();
                }
                string des = sceneCfg.m_SceneDescription.Replace("[\\n]", "\n");
                if (lblIntroduce1 != null)
                {
                    lblIntroduce1.text = des;
                }
                if (role_info != null)
                {
                    SetFightingScore((int)role_info.FightingScore);
                }
                if (lblCurStamina != null)
                {
                    lblCurStamina.text = role_info.CurStamina.ToString();
                }
                //设置掉落数据
                Data_SceneDropOut dropCfg = SceneConfigProvider.Instance.GetSceneDropOutById(sceneCfg.m_DropId);
                if (dropCfg != null)
                {
                    DFMItemIconUtils.Instance.SetItemInfo(ItemIconType.Scene_Award, lblAwardExp, DFMItemIconUtils.Instance.m_Exp, dropCfg.m_Exp);
                    DFMItemIconUtils.Instance.SetItemInfo(ItemIconType.Scene_Award, lblAwardCoin, DFMItemIconUtils.Instance.m_Money, dropCfg.m_GoldSum);

                    SetAwardItem(dropCfg.GetRewardItemByHeroId(role_info.HeroId), dropCfg.m_ItemCountList);
                }
            }
            InitWipeNum();
            InitBtnName();
        }
        catch (Exception ex)
        {
            LogicSystem.LogFromGfx("[Error]:Exception:{0}\n{1}", ex.Message, ex.StackTrace);
        }
    }
Exemplo n.º 11
0
    //初始化所有章
    private void InitChapters(SubSceneType subType)
    {
        m_ChapterList.Clear();
        if (subType == SubSceneType.Common)
        {
            m_SubSceneType = SubSceneType.Common;
            SetButtonSprite(true);
        }
        else
        {
            m_SubSceneType = SubSceneType.Master;
            SetButtonSprite(false);
        }
        //初始化一些数据
        UICurrentChapter.m_UnLockNextScene = false;
        if (goChapter == null || centerOnChild == null)
        {
            return;
        }
        //应该读取所有章节信息
        UIGrid grid = centerOnChild.GetComponent <UIGrid>();

        if (grid == null)
        {
            return;
        }
        int chapterIndex = 1;

        int[] chapterInfo = new int[c_ScenePerChapter];
        ClearArr(chapterInfo);
        int  UnlockChapterMax    = -1;
        bool isNextChapterUnlock = true;

        while (GetChapterInfo(chapterIndex, chapterInfo, subType) && isNextChapterUnlock)
        {
            UnityEngine.GameObject go             = AddChapter(centerOnChild.gameObject, goChapter, chapterIndex - 1);
            UICurrentChapter       currentChapter = go.GetComponent <UICurrentChapter>();
            if (currentChapter != null)
            {
                bool isLockChapter = currentChapter.InitChapterById(chapterIndex, chapterInfo, subType, ref isNextChapterUnlock);
                m_ChapterList.Add(currentChapter);
                if (!isLockChapter && chapterIndex > UnlockChapterMax)
                {
                    UnlockChapterMax = chapterIndex;
                }
            }
            m_UnlockChapterMax = UnlockChapterMax;
            if (m_SubSceneType == SubSceneType.Common)
            {
                m_UnlockCommonChapterMax = UnlockChapterMax;
            }
            else
            {
                m_UnlockMasterChapterMax = UnlockChapterMax;
            }
            ClearArr(chapterInfo);
            grid.Reposition();
            chapterIndex++;
        }
        CenterOnChild(UnlockChapterMax);
        //删除多余章节
        DelChapter(centerOnChild.gameObject, chapterIndex);
        m_ChapterNumber = chapterIndex - 1;
    }
Exemplo n.º 12
0
 void OnEnable()
 {
     try
     {
         m_IsChapterMoving = false;
         RoleInfo info = LobbyClient.Instance.CurrentRole;
         if (null != info)
         {
             if (lblDiamond != null)
             {
                 lblDiamond.text = info.Gold.ToString();
             }
             if (lblMoney != null)
             {
                 lblMoney.text = info.Money.ToString();
             }
             if (lblPlayerLevel != null)
             {
                 lblPlayerLevel.text = info.Level.ToString();
             }
             if (lblPlayerName != null)
             {
                 lblPlayerName.text = info.Nickname;
             }
             UserInfo user_info = info.GetPlayerSelfInfo();
             if (user_info != null)
             {
                 Data_PlayerConfig playerData = PlayerConfigProvider.Instance.GetPlayerConfigById(info.HeroId);
                 if (playerData != null)
                 {
                     if (spPortrait != null)
                     {
                         spPortrait.spriteName = playerData.m_Portrait;
                     }
                 }
             }
         }
         hasCommonChapter = HasCommonChapter();
         hasMasterChapter = HasMasterChapter();
         if (startChapterId > 0)
         {
             StartChapter(startChapterId);
             startChapterId = 0;
         }
         else
         {
             if (!hasCommonChapter)
             {
                 m_SubSceneType = SubSceneType.Master;
             }
             else if (!hasMasterChapter)
             {
                 m_SubSceneType = SubSceneType.Common;
             }
             InitChapters(m_SubSceneType);
         }
     }
     catch (System.Exception ex)
     {
         ArkCrossEngine.LogicSystem.LogErrorFromGfx("Exception {0}\n{1}", ex.Message, ex.StackTrace);
     }
 }
Exemplo n.º 13
0
    //显示与隐藏精英模式
    public void ShowSceneMode(SubSceneType subType, int grade, int npcId)
    {
        bool visible = subType == SubSceneType.Master ? true : false;

        if (goMasterIcon != null)
        {
            NGUITools.SetActive(goMasterIcon, visible);
        }
        if (goCommonIcon != null)
        {
            NGUITools.SetActive(goCommonIcon, !visible);
        }
        if (subType == SubSceneType.Master)
        {
            if (spSceneImage != null)
            {
                UIButton btn = this.GetComponent <UIButton>();
                if (btn != null)
                {
                    btn.normalSprite = c_MasterSpirite;
                }
                spSceneImage.spriteName = c_MasterSpirite;
                spSceneImage.transform.localPosition = masterModePos;
                for (int i = 0; i < starArr.Length; ++i)
                {
                    if (i < grade)
                    {
                        if (starArr[i] != null)
                        {
                            NGUITools.SetActive(starArr[i], true);
                        }
                    }
                    else
                    {
                        if (starArr[i] != null)
                        {
                            NGUITools.SetActive(starArr[i], false);
                        }
                    }
                }
            }
        }
        else
        {
            if (spSceneImage != null)
            {
                UIButton btn = this.GetComponent <UIButton>();
                if (btn != null)
                {
                    btn.normalSprite = c_CommonSpirite;
                }
                spSceneImage.spriteName = c_CommonSpirite;
                spSceneImage.transform.localPosition = commonModePos;
                for (int i = 0; i < starArr.Length; ++i)
                {
                    if (starArr[i] != null)
                    {
                        NGUITools.SetActive(starArr[i], false);
                    }
                }
            }
        }
        //如果npcId!=-1  把头像给加上
        if (npcId != -1)
        {
            //boss关
            Data_NpcConfig npcCfg = NpcConfigProvider.Instance.GetNpcConfigById(npcId);
            if (npcCfg != null && spBossPortrait != null)
            {
                spBossPortrait.spriteName = npcCfg.m_Portrait;
            }
            if (goBossIcon != null)
            {
                NGUITools.SetActive(goBossIcon, true);
            }
            if (goMasterIcon != null)
            {
                NGUITools.SetActive(goMasterIcon, false);
            }
            if (goCommonIcon != null)
            {
                NGUITools.SetActive(goCommonIcon, false);
            }
        }
        else
        {
            if (goBossIcon != null)
            {
                NGUITools.SetActive(goBossIcon, false);
            }
        }
    }
Exemplo n.º 14
0
    //显示奖励信息
    public void ShowAwardInfo(int sceneId, SubSceneType subType, int grade)
    {
        Data_SceneConfig sceneCfg = SceneConfigProvider.Instance.GetSceneConfigById(sceneId);

        if (subType == SubSceneType.Common)
        {
            //普通副本
            NGUITools.SetActive(goCommonAward, true);
            NGUITools.SetActive(goMasterAward, false);
            if (goFinished != null)
            {
                if (grade > 0)
                {
                    NGUITools.SetActive(goFinished, true);
                }
                else
                {
                    NGUITools.SetActive(goFinished, false);
                }
            }
            int dropId = -1;
            if (sceneCfg == null)
            {
                return;
            }
            if (sceneCfg.m_CompletedRewards != null && sceneCfg.m_CompletedRewards.Count > 0)
            {
                dropId = sceneCfg.m_CompletedRewards[0];
            }
            Data_SceneDropOut dropCfg = SceneConfigProvider.Instance.GetSceneDropOutById(dropId);
            if (dropCfg != null)
            {
                List <int> rewardItemIdList = dropCfg.GetRewardItemByHeroId(LobbyClient.Instance.CurrentRole.HeroId);
                if (null != rewardItemIdList && rewardItemIdList.Count > 0)
                {
                    int itemId = rewardItemIdList[0];
                    if (commonAwardSlot != null)
                    {
                        commonAwardSlot.SetId(itemId);
                    }
                    DFMItemIconUtils.Instance.SetItemInfo(ItemIconType.Scene_First, goCommonAward, itemId);
                }
            }
        }
        else
        {
            //精英副本
            NGUITools.SetActive(goCommonAward, false);
            NGUITools.SetActive(goMasterAward, true);
            if (sceneCfg == null || sceneCfg.m_CompletedRewards == null)
            {
                return;
            }
            for (int i = 0; i < sceneCfg.m_CompletedRewards.Count; ++i)
            {
                int dropId = sceneCfg.m_CompletedRewards[i];
                Data_SceneDropOut dropCfg = SceneConfigProvider.Instance.GetSceneDropOutById(dropId);
                if (dropCfg != null)
                {
                    List <int> rewardItemIdList = dropCfg.GetRewardItemByHeroId(LobbyClient.Instance.CurrentRole.HeroId);
                    if (null != rewardItemIdList && rewardItemIdList.Count > 0)
                    {
                        int itemId = rewardItemIdList[0];
                        if (i < masterAwardSlotArr.Length && masterAwardSlotArr[i] != null)
                        {
                            masterAwardSlotArr[i].SetId(itemId);
                        }
                        DFMItemIconUtils.Instance.SetItemInfo(ItemIconType.Scene_Star, texItemArr[i], itemId);
                    }
                }
            }
            for (int i = 0; i < spArrowArr.Length; ++i)
            {
                if (i + 1 < grade)
                {
                    if (spArrowArr[i] != null)
                    {
                        spArrowArr[i].spriteName = c_BrightArrow;
                    }
                }
                else
                {
                    if (spArrowArr[i] != null)
                    {
                        spArrowArr[i].spriteName = c_AshArrow;
                    }
                }
            }
            //指示标志
            if (grade < 3 && grade >= 0 && lblStarNum != null)
            {
                NGUITools.SetActive(goGuide, true);
                lblStarNum.text = (grade + 1).ToString();
                if (grade < m_GuidePosArr.Length)
                {
                    goGuide.transform.localPosition = m_GuidePosArr[grade];
                }
            }
            else
            {
                NGUITools.SetActive(goGuide, false);
            }
            for (int i = 0; i < spFinishedArr.Length; ++i)
            {
                if (i < grade)
                {
                    if (spFinishedArr[i] != null)
                    {
                        NGUITools.SetActive(spFinishedArr[i].gameObject, true);
                    }
                }
                else
                {
                    if (spFinishedArr[i] != null)
                    {
                        NGUITools.SetActive(spFinishedArr[i].gameObject, false);
                    }
                }
            }
            //推荐战力
            if (lblRecommendFighting != null)
            {
                lblRecommendFighting.text = sceneCfg.m_RecommendFighting.ToString();
            }
            SetAwardCondition(grade, sceneCfg);
        }
    }