Пример #1
0
    private void SetBundleImage(WWWItem _item, object _param)
    {
        if (_item.GetSafeBundle() != null && null != _item.GetSafeBundle().mainAsset)
        {
            Texture2D texture2D = _item.GetSafeBundle().mainAsset as Texture2D;
            if (null != texture2D && _param is CustomMonsterProtriteInfo)
            {
                string imageKey = string.Empty;
                CustomMonsterProtriteInfo customMonsterProtriteInfo = _param as CustomMonsterProtriteInfo;
                if (customMonsterProtriteInfo == null)
                {
                    return;
                }
                imageKey = customMonsterProtriteInfo.m_szImageKey;
                NrTSingleton <UIImageBundleManager> .Instance.AddTexture(imageKey, texture2D);

                customMonsterProtriteInfo.m_Material.mainTexture = texture2D;
                if (customMonsterProtriteInfo.m_goAniObject != null)
                {
                    customMonsterProtriteInfo.m_goAniObject.SetActive(true);
                }
            }
        }
    }
Пример #2
0
    public void SetChallengeCount(int nCount, bool bBoss, int[] nMonsterKind)
    {
        Vector2 screenPos = new Vector2(GUICamera.width / 2f, GUICamera.height / 2f);

        if (EffectDefine.IsValidParent(this.m_EffectBattleChallenge))
        {
            this.m_EffectBattleChallenge = NrTSingleton <NkEffectManager> .Instance.CreateEffectUI("FX_BATTLE_CHALLENGE", screenPos, new NkEffectUnit.DeleteCallBack(this.ChallengeEffectDeleteCallBack));
        }
        else
        {
            this.m_EffectBattleChallenge.SetActive(false);
            this.m_EffectBattleChallenge.layer = TsLayer.GUI;
        }
        Transform  child       = NkUtil.GetChild(this.m_EffectBattleChallenge.transform, "fx_text");
        Transform  child2      = NkUtil.GetChild(this.m_EffectBattleChallenge.transform, "fx_final");
        Transform  child3      = NkUtil.GetChild(this.m_EffectBattleChallenge.transform, "fx_challenge");
        Transform  child4      = NkUtil.GetChild(this.m_EffectBattleChallenge.transform, "fx_bonus");
        GameObject gameObject  = null;
        GameObject gameObject2 = null;
        GameObject gameObject3 = null;

        if (child2 != null)
        {
            gameObject = child2.gameObject;
        }
        if (child4 != null)
        {
            gameObject3 = child4.gameObject;
        }
        if (child != null)
        {
            GameObject gameObject4 = child.gameObject;
            if (gameObject4 != null)
            {
                MeshFilter component = gameObject4.GetComponent <MeshFilter>();
                Vector2[]  array     = new Vector2[component.mesh.uv.Length];
                if (component != null)
                {
                    if (Battle.BATTLE.BattleRoomtype == eBATTLE_ROOMTYPE.eBATTLE_ROOMTYPE_MYTHRAID)
                    {
                        Texture2D texture = NrTSingleton <UIImageBundleManager> .Instance.GetTexture(this.m_strText);

                        if (component != null)
                        {
                            array[0].x        = 0f;
                            array[0].y        = 1f;
                            array[1].x        = 1f;
                            array[1].y        = 1f;
                            array[2].x        = 0f;
                            array[2].y        = 0f;
                            array[3].x        = 1f;
                            array[3].y        = 0f;
                            component.mesh.uv = array;
                        }
                        Material material = new Material(Shader.Find("Transparent/Vertex Colored" + NrTSingleton <UIDataManager> .Instance.AddFilePath));
                        if (null != gameObject4.renderer && null != material)
                        {
                            gameObject4.renderer.sharedMaterial = material;
                        }
                        if (null != texture)
                        {
                            material.mainTexture = texture;
                        }
                        else
                        {
                            CustomMonsterProtriteInfo customMonsterProtriteInfo = new CustomMonsterProtriteInfo();
                            customMonsterProtriteInfo.m_goAniObject = gameObject4;
                            customMonsterProtriteInfo.m_Material    = gameObject4.renderer.sharedMaterial;
                            customMonsterProtriteInfo.m_szImageKey  = this.m_strText;
                            string  str     = string.Format("{0}", "UI/mythicraid/" + this.m_strText + NrTSingleton <UIDataManager> .Instance.AddFilePath);
                            WWWItem wWWItem = Holder.TryGetOrCreateBundle(str + Option.extAsset, NkBundleCallBack.UIBundleStackName);
                            wWWItem.SetItemType(ItemType.USER_ASSETB);
                            wWWItem.SetCallback(new PostProcPerItem(this.SetBundleImage), customMonsterProtriteInfo);
                            TsImmortal.bundleService.RequestDownloadCoroutine(wWWItem, DownGroup.RUNTIME, true);
                        }
                    }
                    else if (nCount > 1)
                    {
                        for (int i = 0; i < array.Length; i++)
                        {
                            array[i] = component.mesh.uv[i];
                            Vector2[] expr_360_cp_0 = array;
                            int       expr_360_cp_1 = i;
                            expr_360_cp_0[expr_360_cp_1].y = expr_360_cp_0[expr_360_cp_1].y - this.m_fBattleContinueEffectUV;
                        }
                        if (component != null)
                        {
                            component.mesh.uv = array;
                        }
                    }
                }
            }
            if (bBoss)
            {
                if (nCount < 100)
                {
                    if (gameObject != null)
                    {
                        if (child3.gameObject != null)
                        {
                            child3.gameObject.SetActive(false);
                        }
                        if (gameObject3 != null)
                        {
                            gameObject3.SetActive(false);
                        }
                        gameObject.SetActive(true);
                        Animation component2 = gameObject.GetComponent <Animation>();
                        if (component2 != null)
                        {
                            Battle.BATTLE.m_fContinueBattleWaitTime = Time.realtimeSinceStartup + component2.clip.length + 0.1f;
                        }
                        else
                        {
                            Battle.BATTLE.m_fContinueBattleWaitTime = Time.realtimeSinceStartup + 2f;
                        }
                        NrSound.ImmedatePlay("UI_SFX", "BATTLE", "BATTLE-CONTINUE-BOSS");
                        if (Battle.BATTLE != null)
                        {
                            Battle.BATTLE.PlayBossBGM();
                        }
                    }
                }
                else if (nCount >= 100 && gameObject3 != null)
                {
                    if (child3.gameObject != null)
                    {
                        child3.gameObject.SetActive(false);
                    }
                    if (gameObject != null)
                    {
                        gameObject.SetActive(false);
                    }
                    gameObject3.SetActive(true);
                    Animation component3 = gameObject3.GetComponent <Animation>();
                    if (component3 != null)
                    {
                        Battle.BATTLE.m_fContinueBattleWaitTime = Time.realtimeSinceStartup + component3.clip.length + 0.1f;
                    }
                    else
                    {
                        Battle.BATTLE.m_fContinueBattleWaitTime = Time.realtimeSinceStartup + 2f;
                    }
                    NrSound.ImmedatePlay("UI_SFX", "BATTLE", "HIDDEN_BONUS");
                    if (Battle.BATTLE != null)
                    {
                        Battle.BATTLE.PlayBossBGM();
                    }
                }
            }
            else
            {
                child3.gameObject.SetActive(false);
                gameObject2 = child3.gameObject;
                if (gameObject != null)
                {
                    gameObject.SetActive(false);
                }
                if (gameObject3 != null)
                {
                    gameObject3.SetActive(false);
                }
                NrSound.ImmedatePlay("UI_SFX", "BATTLE", "BATTLE-CONTINUE");
            }
        }
        if (!bBoss)
        {
            for (int j = 0; j < 6; j++)
            {
                NrCharKindInfo charKindInfo = NrTSingleton <NrCharKindInfoManager> .Instance.GetCharKindInfo(nMonsterKind[j]);

                string         strName = string.Empty;
                string         text    = string.Empty;
                eCharImageType type;
                if (j == 0)
                {
                    strName = string.Format("fx_boss", new object[0]);
                    if (charKindInfo != null)
                    {
                        if (UIDataManager.IsUse256Texture())
                        {
                            text = charKindInfo.GetPortraitFile1(-1, string.Empty) + "_256";
                        }
                        else
                        {
                            text = charKindInfo.GetPortraitFile1(-1, string.Empty) + "_512";
                        }
                    }
                    type = eCharImageType.LARGE;
                }
                else
                {
                    strName = string.Format("fx_enemy0{0}", j.ToString());
                    if (charKindInfo != null)
                    {
                        text = charKindInfo.GetPortraitFile1(-1, string.Empty) + "_64";
                    }
                    type = eCharImageType.SMALL;
                }
                Transform child5 = NkUtil.GetChild(this.m_EffectBattleChallenge.transform, strName);
                if (child5 != null)
                {
                    GameObject gameObject5 = child5.gameObject;
                    if (null != gameObject5)
                    {
                        if (charKindInfo == null)
                        {
                            gameObject5.SetActive(false);
                        }
                        else
                        {
                            gameObject5.SetActive(true);
                            Renderer component4 = gameObject5.GetComponent <Renderer>();
                            if (component4 != null)
                            {
                                Material material2 = component4.material;
                                if (null != material2)
                                {
                                    if (null == NrTSingleton <UIImageBundleManager> .Instance.GetTexture(text))
                                    {
                                        CustomMonsterProtriteInfo customMonsterProtriteInfo2 = new CustomMonsterProtriteInfo();
                                        customMonsterProtriteInfo2.m_goAniObject = gameObject2;
                                        customMonsterProtriteInfo2.m_Material    = material2;
                                        customMonsterProtriteInfo2.m_szImageKey  = text;
                                        NrTSingleton <UIImageBundleManager> .Instance.RequestCharImageCustomParam(text, type, new PostProcPerItem(this.SetBundleImage), customMonsterProtriteInfo2);
                                    }
                                    else
                                    {
                                        material2.mainTexture = NrTSingleton <UIImageBundleManager> .Instance.GetTexture(text);

                                        gameObject2.SetActive(true);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        Vector2 screenPos2 = new Vector2((float)(Screen.width / 2), (float)(Screen.height / 2));

        this.m_EffectBattleChallenge.transform.position = base.GetEffectUIPos(screenPos2);
        this.m_EffectBattleChallenge.SetActive(true);
        this.m_nCurrentContinueCount = nCount;
    }