Beispiel #1
0
    private void SetButtonImage(UIBaseInfoLoader kBaseInfo)
    {
        base.SetSpriteTile(kBaseInfo.Tile, kBaseInfo.UVs.width / (float)kBaseInfo.ButtonCount, kBaseInfo.UVs.height);
        this.m_bPattern = kBaseInfo.Pattern;
        Material material = (Material)CResources.Load(kBaseInfo.Material);

        base.Setup(this.width, this.height, material);
        float pixelToUVsWidth = this.GetPixelToUVsWidth(material, kBaseInfo.UVs.width / (float)kBaseInfo.ButtonCount);
        Rect  rect            = new Rect(this.GetPixelToUVsWidth(material, kBaseInfo.UVs.x) - pixelToUVsWidth, 1f - this.GetPixelToUVsHeight(material, kBaseInfo.UVs.y + kBaseInfo.UVs.height), pixelToUVsWidth, this.GetPixelToUVsHeight(material, kBaseInfo.UVs.height));
        Rect  uvs             = new Rect(rect);

        uvs.x += pixelToUVsWidth;
        for (int i = 0; i < 4; i++)
        {
            this.States[i].spriteFrames    = new CSpriteFrame[1];
            this.States[i].spriteFrames[0] = new CSpriteFrame();
            rect.x += pixelToUVsWidth;
            if ((int)kBaseInfo.ButtonCount <= i)
            {
                this.States[i].spriteFrames[0].uvs = uvs;
            }
            else
            {
                this.States[i].spriteFrames[0].uvs = rect;
            }
            this.animations[i] = new UVAnimation();
            this.animations[i].SetAnim(this.States[i], i);
        }
        base.PlayAnim(0, 0);
    }
 private void LoadViocePlay(string filename)
 {
     if (!string.IsNullOrEmpty(filename))
     {
         AudioClip audioClip = CResources.Load(filename) as AudioClip;
         if (audioClip == null)
         {
             TsLog.Log("!!PatchLoadingData Voice File[ {0} ]== NULL!!", new object[]
             {
                 filename
             });
             return;
         }
         if (this.pTouchVoiceObject.GetComponent <AudioSource>() == null)
         {
             this.pTouchVoiceObject.AddComponent <AudioSource>();
         }
         AudioSource component = this.pTouchVoiceObject.GetComponent <AudioSource>();
         if (component != null)
         {
             component.PlayOneShot(audioClip);
         }
         else
         {
             TsLog.LogWarning("!!AudioSource Play Error", new object[0]);
         }
     }
 }
    public override void SetComponent()
    {
        base.SetSize(GUICamera.width, GUICamera.height);
        base.SetLocation(0f, 0f);
        this.Drawtexture_DTBG03.SetSize(GUICamera.width, GUICamera.height);
        this.DT_IntroMovie.SetLocation(0, 0);
        float num  = GUICamera.width * 0.9f;
        float num2 = GUICamera.height * 0.05f;

        this.DT_DrawTexture_DrawTexture29.SetLocation(num, num2);
        this.BT_PlayMovie.SetLocation(num + 29f, num2 + 15f);
        this.LB_Open.SetLocation(this.BT_PlayMovie.GetLocationX(), this.BT_PlayMovie.GetLocationY() + this.BT_PlayMovie.width - 18f);
        this.Toggle_Portrait01.SetLocation(this.BT_PlayMovie.GetLocationX() - 22f, this.BT_PlayMovie.GetLocationY() + this.BT_PlayMovie.GetSize().y + 12f);
        this.Toggle_Portrait02.SetLocation(this.Toggle_Portrait01.GetLocationX(), this.Toggle_Portrait01.GetLocationY() + this.Toggle_Portrait01.GetSize().y);
        this.Toggle_Portrait03.SetLocation(this.Toggle_Portrait01.GetLocationX(), this.Toggle_Portrait02.GetLocationY() + this.Toggle_Portrait02.GetSize().y);
        this.DT_Portrait01.SetLocation(this.Toggle_Portrait01.GetLocationX() + 22f, this.Toggle_Portrait01.GetLocationY() + 25f);
        this.DT_Portrait02.SetLocation(this.Toggle_Portrait02.GetLocationX() + 22f, this.Toggle_Portrait02.GetLocationY() + 25f);
        this.DT_Portrait03.SetLocation(this.Toggle_Portrait03.GetLocationX() + 22f, this.Toggle_Portrait03.GetLocationY() + 25f);
        num2 = GUICamera.height * 0.65f;
        this.LB_Open.Text = NrTSingleton <NrTextMgr> .Instance.GetTextFromPreloadText("2034");

        this.SetLoadingSize(10f);
        Texture texture = (Texture)CResources.Load(NrTSingleton <UIDataManager> .Instance.FilePath + "Texture/loginBG_mobile");

        this.Drawtexture_DTBG03.SetTexture(texture);
        this.SetGui();
    }
Beispiel #4
0
    public void SetupBalck_BG(string imagekey, float x, float y, float w, float h)
    {
        UIBaseInfoLoader uIBaseInfoLoader = NrTSingleton <UIImageInfoManager> .Instance.FindUIImageDictionary(imagekey);

        if (uIBaseInfoLoader == null)
        {
            return;
        }
        base.BLACK_BG            = Box.Create("Win_T_BK", new Vector3(0f, 0f, 0.1f));
        base.BLACK_BG.autoResize = true;
        base.BLACK_BG.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT);
        base.BLACK_BG.gameObject.layer = GUICamera.UILayer;
        BoxCollider boxCollider = (BoxCollider)base.BLACK_BG.gameObject.AddComponent(typeof(BoxCollider));

        if (null != boxCollider)
        {
            boxCollider.size   = new Vector3(GUICamera.width, GUICamera.height, 0f);
            boxCollider.center = new Vector3(GUICamera.width / 2f, -GUICamera.height / 2f, 0f);
        }
        base.InteractivePanel.MakeChild(base.BLACK_BG.gameObject);
        base.BLACK_BG.transform.localPosition = new Vector3(-base.GetLocation().x, -base.GetLocation().y, 0.1f);
        base.BLACK_BG.SetSpriteTile(uIBaseInfoLoader.Tile, uIBaseInfoLoader.UVs.width, uIBaseInfoLoader.UVs.height);
        base.BLACK_BG.m_bPattern = uIBaseInfoLoader.Pattern;
        Material material = (Material)CResources.Load(uIBaseInfoLoader.Material);

        base.BLACK_BG.Setup(w, h, material);
        base.BLACK_BG.SetTextureUVs(new Vector2(uIBaseInfoLoader.UVs.x, uIBaseInfoLoader.UVs.y + uIBaseInfoLoader.UVs.height), new Vector2(uIBaseInfoLoader.UVs.width, uIBaseInfoLoader.UVs.height));
        base.BLACK_BG.SetColor(new Color(1f, 1f, 1f, 0.8f));
    }
Beispiel #5
0
    public override void SetComponent()
    {
        base.SetLocation((GUICamera.width - base.GetSizeX()) / 2f, (GUICamera.height - base.GetSizeY()) / 2f);
        float x = -(GUICamera.width - base.GetSizeX()) / 2f;

        this.m_LoadingStage = (base.GetControl("DrawTexture_LoadingIcon") as DrawTexture);
        this.m_Up           = (base.GetControl("DrawTexture_UpperScreen") as DrawTexture);
        this.m_Up.SetSize(GUICamera.width, this.m_Up.GetSize().y + (GUICamera.height - base.GetSizeY()) / 2f);
        this.m_Up.SetLocation(x, this.m_Up.GetSize().y - (GUICamera.height - base.GetSizeY()) / 2f - 1f);
        this.m_Down = (base.GetControl("DrawTexture_LowerScreen") as DrawTexture);
        this.m_Down.SetSize(GUICamera.width, this.m_Down.GetSize().y + (GUICamera.height - base.GetSizeY()) / 2f);
        this.m_Down.SetLocation(x, GUICamera.height - this.m_Down.GetSize().y - (GUICamera.height - base.GetSizeY()) / 2f + 1f);
        this.m_Tip            = (base.GetControl("Label_Tip") as Label);
        this.m_Tip.Text       = " ";
        this.m_Left           = (base.GetControl("DrawTexture_ImgLeft") as DrawTexture);
        this.m_Left.Visible   = false;
        this.m_Center         = (base.GetControl("DrawTexture_ImgCenter") as DrawTexture);
        this.m_Center.Visible = false;
        this.m_Percent        = (base.GetControl("Label_LoadingRate") as Label);
        this.m_Percent.Text   = "0%";
        this.SetLoadingSize();
        this.ParseToolTip();
        this.m_BG = (base.GetControl("DrawTexture_BG") as DrawTexture);
        string str = string.Empty;

        str = NrTSingleton <UIDataManager> .Instance.FilePath + "Texture/Loading/loading_BG";
        this.m_BG.SetLocation(x, -(GUICamera.height - base.GetSizeY()) / 2f);
        this.m_BG.SetSize(GUICamera.width, GUICamera.height);
        this.m_BG.SetTexture((Texture2D)CResources.Load(str + NrTSingleton <UIDataManager> .Instance.AddFilePath));
        this.m_lbLoadingStatus = (base.GetControl("LB_LoadingStatus1") as Label);
        this.m_lbPacketNum     = (base.GetControl("LB_LoadingStatus2") as Label);
        this.Hide();
    }
        public static DrawTexture DrawTexture(string name, string imageKey, float width, float height, bool useBox)
        {
            DrawTexture result;

            using (new ScopeProfile("UICreateControl - DrawTexture"))
            {
                UIBaseInfoLoader uIBaseInfoLoader = UIBaseFileManager.FindUIImageDictionary(name, imageKey);
                if (uIBaseInfoLoader == null)
                {
                    result = null;
                }
                else
                {
                    GameObject  gameObject  = new GameObject(name);
                    DrawTexture drawTexture = gameObject.AddComponent <DrawTexture>();
                    drawTexture.autoResize       = false;
                    drawTexture.gameObject.layer = GUICamera.UILayer;
                    drawTexture.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT);
                    drawTexture.SetSpriteTile(uIBaseInfoLoader.Tile, uIBaseInfoLoader.UVs.width / (float)uIBaseInfoLoader.ButtonCount, uIBaseInfoLoader.UVs.height);
                    drawTexture.m_bPattern = uIBaseInfoLoader.Pattern;
                    Material material = (Material)CResources.Load(uIBaseInfoLoader.Material);
                    drawTexture.Setup(width, height, material);
                    drawTexture.SetTextureUVs(new Vector2(uIBaseInfoLoader.UVs.x, uIBaseInfoLoader.UVs.y + uIBaseInfoLoader.UVs.height), new Vector2(uIBaseInfoLoader.UVs.width / (float)uIBaseInfoLoader.ButtonCount, uIBaseInfoLoader.UVs.height));
                    drawTexture.Start();
                    drawTexture.UsedCollider(useBox);
                    result = drawTexture;
                }
            }
            return(result);
        }
        public static Emoticon Emoticon(string name, float emoticonWidth, float emoticonHeight, UIBaseInfoLoader baseInfoLoder, float[] delays)
        {
            GameObject gameObject = new GameObject(name);
            Emoticon   emoticon   = gameObject.AddComponent <Emoticon>();

            emoticon.SetDelay(delays);
            emoticon.SetUseBoxCollider(false);
            emoticon.gameObject.layer = GUICamera.UILayer;
            emoticon.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT);
            emoticon.AutoAnimatorStop = false;
            if (baseInfoLoder != null)
            {
                emoticon.SetSpriteTile(baseInfoLoder.Tile, baseInfoLoder.UVs.width / (float)baseInfoLoder.ButtonCount, baseInfoLoder.UVs.height);
                Material material = (Material)CResources.Load(baseInfoLoder.Material);
                emoticon.Setup(emoticonWidth, emoticonHeight, material);
                float pixelToUVsWidth = UIBaseFileManager.GetPixelToUVsWidth(material, baseInfoLoder.UVs.width / (float)baseInfoLoder.ButtonCount);
                Rect  uvs             = new Rect(UIBaseFileManager.GetPixelToUVsWidth(material, baseInfoLoder.UVs.x) - pixelToUVsWidth, 1f - UIBaseFileManager.GetPixelToUVsHeight(material, baseInfoLoder.UVs.y + baseInfoLoder.UVs.height), pixelToUVsWidth, UIBaseFileManager.GetPixelToUVsHeight(material, baseInfoLoder.UVs.height));
                for (int i = 0; i < 3; i++)
                {
                    emoticon.States[i].spriteFrames    = new CSpriteFrame[1];
                    emoticon.States[i].spriteFrames[0] = new CSpriteFrame();
                    uvs.x += pixelToUVsWidth;
                    emoticon.States[i].spriteFrames[0].uvs = uvs;
                    emoticon.animations[i] = new UVAnimation();
                    emoticon.animations[i].SetAnim(emoticon.States[i], i);
                }
                emoticon.autoResize = false;
            }
            return(emoticon);
        }
    public override void SetComponent()
    {
        this.m_lbResult = (base.GetControl("Label_Result") as Label);
        this.m_lbResult.SetCharacterSize(45f);
        this.m_lbItem    = (base.GetControl("Label_RootItem") as Label);
        this.m_dtTotalBG = (base.GetControl("DrawTexture_TotalBG") as DrawTexture);
        this.m_dtWinLose = (base.GetControl("DrawTexture_DrawTexture1_C") as DrawTexture);
        string    path    = string.Format("{0}Texture/Loading/0{1}", NrTSingleton <UIDataManager> .Instance.FilePath, NrTSingleton <UIDataManager> .Instance.AddFilePath);
        Texture2D texture = (Texture2D)CResources.Load(path);

        this.m_dtTotalBG.SetTexture(texture);
        this.m_lbSolList          = (base.GetControl("NLB_SolGetExp") as NewListBox);
        this.m_lbSolList.Reserve  = false;
        this.m_lbItemList         = (base.GetControl("NLB_MineItemList") as NewListBox);
        this.m_lbItemList.Reserve = false;
        this.m_btTakeReward       = (base.GetControl("Button_ok") as Button);
        Button expr_FF = this.m_btTakeReward;

        expr_FF.Click                 = (EZValueChangedDelegate)Delegate.Combine(expr_FF.Click, new EZValueChangedDelegate(this.OnClickTakReward));
        this.m_lbContRankList         = (base.GetControl("NLB_MineRank") as NewListBox);
        this.m_lbContRankList.Reserve = false;
        this.m_btReplay               = (base.GetControl("Button_Replay") as Button);
        Button expr_15E = this.m_btReplay;

        expr_15E.Click = (EZValueChangedDelegate)Delegate.Combine(expr_15E.Click, new EZValueChangedDelegate(this.OnClickReplay));
    }
Beispiel #9
0
    public override void SetComponent()
    {
        this.m_DT_BG         = (base.GetControl("DrawTexture_ReConnectBG") as DrawTexture);
        this.m_DT_NpcImg     = (base.GetControl("DrawTexture_NPCIMG") as DrawTexture);
        this.m_LB_BubbleText = (base.GetControl("Label_BubbleText") as Label);
        this.m_BT_Ok         = (base.GetControl("Button_OK") as Button);
        this.m_BT_Exit       = (base.GetControl("Button_exit") as Button);
        this.m_BT_Ok.AddValueChangedDelegate(new EZValueChangedDelegate(this.On_ClickBT_Ok));
        this.m_BT_Exit.AddValueChangedDelegate(new EZValueChangedDelegate(this.On_ClickBT_Exit));
        string    str     = NrTSingleton <UIDataManager> .Instance.FilePath + "Texture/Loading/loading_BG";
        Texture2D texture = (Texture2D)CResources.Load(str + NrTSingleton <UIDataManager> .Instance.AddFilePath);

        this.m_DT_BG.SetTexture(texture);
        this.m_DT_NpcImg.SetTextureFromBundle(string.Format("UI/Soldier/256/mine_256", new object[0]));
        this.m_LB_BubbleText.SetText(NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("2563"));
        this.m_BT_Ok.SetText(NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("2565"));
        this.m_BT_Exit.SetText(NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("216"));
        if (TsPlatform.IsIPhone)
        {
            this.m_BT_Exit.Visible = false;
        }
        base.Draggable = false;
        base.SetSize(GUICamera.width, GUICamera.height);
        this.m_DT_BG.SetSize(GUICamera.width, GUICamera.height);
        base.SetScreenCenter();
        if (NrTSingleton <FormsManager> .Instance.IsShow(G_ID.DLG_LOADINGPAGE))
        {
            NrTSingleton <FormsManager> .Instance.CloseForm(G_ID.DLG_LOADINGPAGE);
        }
    }
        public static TextField TextField(string name, string str, bool multiLine, float maxWidth, float height, float fontSize, SpriteText.Font_Effect fontEffect, SpriteText.Anchor_Pos anchor, string fontColor)
        {
            GameObject gameObject = new GameObject(name);
            TextField  textField  = gameObject.AddComponent <TextField>();

            if (null == textField)
            {
                return(null);
            }
            textField.customCollider   = false;
            textField.gameObject.layer = GUICamera.UILayer;
            textField.width            = maxWidth;
            textField.height           = height;
            textField.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT);
            textField.includeTextInAutoCollider = false;
            textField.DefaultTextAnchor         = anchor;
            if (anchor == SpriteText.Anchor_Pos.Upper_Left || (anchor == SpriteText.Anchor_Pos.Middle_Left | anchor == SpriteText.Anchor_Pos.Lower_Left))
            {
                textField.DefaultTextAlignment = SpriteText.Alignment_Type.Left;
            }
            else if (anchor == SpriteText.Anchor_Pos.Upper_Center || (anchor == SpriteText.Anchor_Pos.Middle_Center | anchor == SpriteText.Anchor_Pos.Lower_Center))
            {
                textField.DefaultTextAlignment = SpriteText.Alignment_Type.Center;
            }
            if (anchor == SpriteText.Anchor_Pos.Upper_Right || anchor == SpriteText.Anchor_Pos.Middle_Right || anchor == SpriteText.Anchor_Pos.Lower_Right)
            {
                textField.DefaultTextAlignment = SpriteText.Alignment_Type.Right;
            }
            textField.fontSize  = fontSize;
            textField.multiLine = multiLine;
            textField.maxWidth  = maxWidth;
            UIBaseInfoLoader uIBaseInfoLoader = NrTSingleton <UIImageInfoManager> .Instance.FindUIImageDictionary("Com_I_Transparent");

            textField.SetSpriteTile(uIBaseInfoLoader.Tile, uIBaseInfoLoader.UVs.width, uIBaseInfoLoader.UVs.height);
            textField.m_bPattern = uIBaseInfoLoader.Pattern;
            Material material = (Material)CResources.Load(uIBaseInfoLoader.Material);

            textField.Setup(maxWidth, height, material);
            textField.States[0].spriteFrames    = new CSpriteFrame[1];
            textField.States[0].spriteFrames[0] = new CSpriteFrame();
            Rect rect = new Rect(UIBaseFileManager.GetPixelToUVsWidth(material, uIBaseInfoLoader.UVs.x), 1f - UIBaseFileManager.GetPixelToUVsHeight(material, uIBaseInfoLoader.UVs.y + uIBaseInfoLoader.UVs.height), UIBaseFileManager.GetPixelToUVsWidth(material, uIBaseInfoLoader.UVs.width), UIBaseFileManager.GetPixelToUVsHeight(material, uIBaseInfoLoader.UVs.height));

            textField.States[0].spriteFrames[0].uvs = rect;
            textField.SetUVs(rect);
            textField.autoResize                = false;
            textField.anchor                    = SpriteRoot.ANCHOR_METHOD.UPPER_LEFT;
            textField.States[1].spriteFrames    = new CSpriteFrame[1];
            textField.States[1].spriteFrames[0] = new CSpriteFrame();
            Rect uvs = new Rect(0f, 0f, 1f, 1f);

            textField.States[1].spriteFrames[0].uvs = uvs;
            textField.CreateSpriteText();
            textField.ColorText = fontColor;
            textField.SetCharacterSize(fontSize);
            textField.SetFontEffect(fontEffect);
            textField.Text = str;
            textField.Start();
            return(textField);
        }
        public static UIRadioBtn RadioBtn(Form form, string name, string imageKey, float width, float height)
        {
            UIBaseInfoLoader uIBaseInfoLoader = UIBaseFileManager.FindUIImageDictionary(name, imageKey);

            if (uIBaseInfoLoader == null)
            {
                return(null);
            }
            GameObject gameObject = new GameObject(name);
            UIRadioBtn uIRadioBtn = gameObject.AddComponent <UIRadioBtn>();

            uIRadioBtn.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT);
            uIRadioBtn.gameObject.layer = GUICamera.UILayer;
            uIRadioBtn.SetSpriteTile(uIBaseInfoLoader.Tile, uIBaseInfoLoader.UVs.width / (float)uIBaseInfoLoader.ButtonCount, uIBaseInfoLoader.UVs.height);
            uIRadioBtn.m_bPattern = uIBaseInfoLoader.Pattern;
            Material material = (Material)CResources.Load(uIBaseInfoLoader.Material);

            uIRadioBtn.Setup(width, height, material);
            float pixelToUVsWidth = UIBaseFileManager.GetPixelToUVsWidth(material, uIBaseInfoLoader.UVs.width / (float)uIBaseInfoLoader.ButtonCount);
            Rect  uvs             = new Rect(UIBaseFileManager.GetPixelToUVsWidth(material, uIBaseInfoLoader.UVs.x) - pixelToUVsWidth, 1f - UIBaseFileManager.GetPixelToUVsHeight(material, uIBaseInfoLoader.UVs.y + uIBaseInfoLoader.UVs.height), pixelToUVsWidth, UIBaseFileManager.GetPixelToUVsHeight(material, uIBaseInfoLoader.UVs.height));

            for (int i = 0; i <= (int)(uIBaseInfoLoader.ButtonCount - 1); i++)
            {
                uIRadioBtn.States[i].spriteFrames    = new CSpriteFrame[1];
                uIRadioBtn.States[i].spriteFrames[0] = new CSpriteFrame();
                uvs.x += pixelToUVsWidth;
                uIRadioBtn.States[i].spriteFrames[0].uvs = uvs;
                uIRadioBtn.animations[i].SetAnim(uIRadioBtn.States[i], i);
            }
            uIRadioBtn.autoResize           = false;
            uIRadioBtn.useParentForGrouping = false;
            uIRadioBtn.SetGroup(100 * form.WindowID);
            form.AddDictionaryControl(name, uIRadioBtn);
            form.InteractivePanel.MakeChild(uIRadioBtn.gameObject);
            uIRadioBtn.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT);
            uIRadioBtn.gameObject.layer = GUICamera.UILayer;
            UIButton uIButton = UICreateControl.Button(name + "OverButton", imageKey + "_over", uIRadioBtn.width, uIRadioBtn.height);

            if (null != uIButton)
            {
                uIButton.Start();
                BoxCollider component = uIButton.gameObject.GetComponent <BoxCollider>();
                if (null != component)
                {
                    UnityEngine.Object.Destroy(component);
                }
                form.InteractivePanel.MakeChild(uIButton.gameObject);
                uIRadioBtn.layers = new SpriteRoot[1];
                for (int j = 0; j < 1; j++)
                {
                    uIRadioBtn.layers[j]             = uIButton;
                    uIButton.transform.localPosition = uIRadioBtn.GetLocation();
                }
            }
            uIRadioBtn.Start();
            return(uIRadioBtn);
        }
    public void _SetComponetBasic()
    {
        this.m_dtTotalBG         = (base.GetControl("DrawTexture_TotalBG") as DrawTexture);
        this.m_dtTopBG           = (base.GetControl("DrawTexture_DrawTexture3") as DrawTexture);
        this.m_dtWinLose         = (base.GetControl("DrawTexture_DrawTexture1_C") as DrawTexture);
        this.m_dtWinLose.Visible = false;
        string    path    = string.Format("{0}Texture/Loading/0{1}", NrTSingleton <UIDataManager> .Instance.FilePath, NrTSingleton <UIDataManager> .Instance.AddFilePath);
        Texture2D texture = (Texture2D)CResources.Load(path);

        this.m_dtTotalBG.SetTexture(texture);
    }
    public void Setup(float w, float h, string strUIKey)
    {
        UIBaseInfoLoader uIBaseInfoLoader = NrTSingleton <UIImageInfoManager> .Instance.FindUIImageDictionary(strUIKey);

        if (uIBaseInfoLoader != null)
        {
            base.SetSpriteTile(uIBaseInfoLoader.Tile, uIBaseInfoLoader.UVs.width, uIBaseInfoLoader.UVs.height);
            Material material = (Material)CResources.Load(uIBaseInfoLoader.Material);
            this.Setup(w, h, new Vector2(uIBaseInfoLoader.UVs.x, uIBaseInfoLoader.UVs.y + uIBaseInfoLoader.UVs.height), new Vector2(uIBaseInfoLoader.UVs.width, uIBaseInfoLoader.UVs.height), material);
        }
    }
Beispiel #14
0
    // Use this for initialization
    IEnumerator Start()
    {
        GameObject obj2 = CResources.Load <GameObject>("A/Cube");

        GameObject obj = CResources.Instantiate(obj2);


        CResources.Destroy(obj);


        yield break;
    }
Beispiel #15
0
    public void Create(string[] _TexRes, float _Width, float _Height, float _Spacing)
    {
        int num = _TexRes.Length;

        for (int i = 0; i < num; i++)
        {
            this.mTexNums[i] = (Texture2D)CResources.Load(_TexRes[i]);
        }
        this.mWidth   = _Width;
        this.mHeight  = _Height;
        this.mSpacing = _Spacing;
    }
    public override void SetComponent()
    {
        this.bgImage = (base.GetControl("DrawTexture_BG01") as DrawTexture);
        Texture2D texture2D = CResources.Load(NrTSingleton <UIDataManager> .Instance.FilePath + "Texture/bg_solcompose") as Texture2D;

        if (null != texture2D)
        {
            this.bgImage.SetSize(GUICamera.width, GUICamera.height);
            this.bgImage.SetTexture(texture2D);
        }
        this.lbExtractItemCount = (base.GetControl("Label_Extract_Result") as Label);
        this.lbExtractItemCount.SetLocation(GUICamera.width / 2f - this.lbExtractItemCount.GetSize().x / 2f, this.lbExtractItemCount.GetLocationY(), -90f);
        this.lbExtractItemCount.Visible = false;
        this.btnOk = (base.GetControl("Button_Confirm") as Button);
        Button expr_E1 = this.btnOk;

        expr_E1.Click = (EZValueChangedDelegate)Delegate.Combine(expr_E1.Click, new EZValueChangedDelegate(this.BtnClickOk));
        this.btnOk.SetLocation(GUICamera.width / 2f - this.btnOk.GetSize().x / 2f, this.btnOk.GetLocationY(), -90f);
        this.btnOk.Hide(true);
        SolComposeMainDlg solComposeMainDlg = NrTSingleton <FormsManager> .Instance.GetForm(G_ID.SOLCOMPOSE_MAIN_DLG) as SolComposeMainDlg;

        if (solComposeMainDlg == null)
        {
            solComposeMainDlg = (NrTSingleton <FormsManager> .Instance.GetForm(G_ID.SOLCOMPOSE_MAIN_CHALLENGEQUEST_DLG) as SolComposeMainDlg);
        }
        if (solComposeMainDlg != null)
        {
            this.m_SolComposeMainType = solComposeMainDlg.GetSolComposeType();
            if (this.m_SolComposeMainType == SOLCOMPOSE_TYPE.EXTRACT)
            {
                this.bgImage.SetTextureKey("Win_T_WH");
                string str = string.Empty;
                str = string.Format("effect/instant/fx_direct_extraction{0}", NrTSingleton <UIDataManager> .Instance.AddFilePath);
                WWWItem wWWItem = Holder.TryGetOrCreateBundle(str + Option.extAsset, NkBundleCallBack.UIBundleStackName);
                wWWItem.SetItemType(ItemType.USER_ASSETB);
                wWWItem.SetCallback(new PostProcPerItem(this.SolComposeExtract), null);
                TsImmortal.bundleService.RequestDownloadCoroutine(wWWItem, DownGroup.RUNTIME, true);
            }
            else
            {
                string str2 = string.Empty;
                str2 = string.Format("UI/Soldier/fx_direct_solcompose{0}", NrTSingleton <UIDataManager> .Instance.AddFilePath);
                WWWItem wWWItem2 = Holder.TryGetOrCreateBundle(str2 + Option.extAsset, NkBundleCallBack.UIBundleStackName);
                wWWItem2.SetItemType(ItemType.USER_ASSETB);
                wWWItem2.SetCallback(new PostProcPerItem(this.SolComposeSuccess), null);
                TsImmortal.bundleService.RequestDownloadCoroutine(wWWItem2, DownGroup.RUNTIME, true);
            }
        }
        UIDataManager.MuteSound(true);
        this.SetSize();
        base.DonotDepthChange(360f);
        this.Hide();
    }
    public void _SetComponetBasic()
    {
        this.m_dtTotalBG    = (base.GetControl("DrawTexture_TotalBG") as DrawTexture);
        this.m_lbResult     = (base.GetControl("Label_Result") as Label);
        this.m_lbBattleTime = (base.GetControl("Label_BattleTime") as Label);
        this.m_lbResult.SetCharacterSize(45f);
        this.m_lbResult.Visible     = false;
        this.m_lbBattleTime.Visible = false;
        string    path    = string.Format("{0}Texture/Loading/0{1}", NrTSingleton <UIDataManager> .Instance.FilePath, NrTSingleton <UIDataManager> .Instance.AddFilePath);
        Texture2D texture = (Texture2D)CResources.Load(path);

        this.m_dtTotalBG.SetTexture(texture);
    }
    public void Setup(float w, float h, string strUIKey)
    {
        UIBaseInfoLoader uIBaseInfoLoader = NrTSingleton <UIImageInfoManager> .Instance.FindUIImageDictionary(strUIKey);

        if (uIBaseInfoLoader == null)
        {
            TsLog.Log("FindUIImageDictionary Failed = " + strUIKey + Time.time, new object[0]);
        }
        base.SetSpriteTile(uIBaseInfoLoader.Tile, uIBaseInfoLoader.UVs.width, uIBaseInfoLoader.UVs.height);
        Material material = (Material)CResources.Load(uIBaseInfoLoader.Material);

        this.Setup(w, h, material);
    }
Beispiel #19
0
    public void CreateIndex(string _TexRes, long[] _Number, float _Width, float _Height, float _Spacing)
    {
        int num = _Number.Length;

        for (int i = 0; i < num; i++)
        {
            long num2 = _Number[i];
            this.mTexNums[(int)(checked ((IntPtr)num2))] = (Texture2D)CResources.Load(_TexRes + num2);
        }
        this.mWidth   = _Width;
        this.mHeight  = _Height;
        this.mSpacing = _Spacing;
    }
Beispiel #20
0
        public void SetValue(object newObj)
        {
            if (newObj == null)
            {
                return;
            }

            if (_mComponentAttr.MCustomField != M_CustomField.Null) //先处理自定义的值
            {
                switch (_mComponentAttr.MCustomField)
                {
                case M_CustomField.ResourcePath:
                    if (_mComponentAttr.MComponentType == M_ComponentType.Image)
                    {
                        if (value != null && value.ToString() == newObj.ToString())
                        {
                            break;
                        }
                        var c = component as Image;
                        c.sprite   = CResources.Load <Sprite>(newObj.ToString());
                        this.value = newObj;
                    }
                    break;

                case M_CustomField.GameObjectActive:
                {
                    component.gameObject.SetActive((bool)newObj);
                    this.value = newObj;
                }
                break;

                case M_CustomField.ComponentEnable:
                {
                    component.enabled = ((bool)newObj);
                    this.value        = newObj;
                }
                break;
                }
            }
            else
            {
                SetComponentValue(typesMap[_mComponentAttr.MComponentType], _mComponentAttr.ComponentField, this.component, newObj);
            }
        }
    private void loadIcons()
    {
        //加载数据
        var dialTable = SqliteHelper.DB.GetTableRuntime().ToSearch <Dial>();

        foreach (var d in dialTable)
        {
            //Debug.LogError(JsonMapper.ToJson(d));
            var o  = CResources.Load <GameObject>("Views/EnteranceIcon");
            var go = GameObject.Instantiate(o);
            go.transform.parent     = tf_Content;
            go.transform.localScale = Vector3.one;
            var subIcon = new CUIIcon(go.transform);
            subIcon.Init();
            var data = WindowData.Create("IconsData");
            data.AddData("IconsData", d);
            subIcon.Open(data);
        }
    }
Beispiel #22
0
 public override void Open(WindowData data = null)
 {
     base.Open();
     if (data != null)
     {
         foreach (var v in data.DataMap)
         {
             var dial = v.Value as Dial;
             dialInfo        = dial;
             img_Icon.sprite = CResources.Load <Sprite>(dial.Icon);
             if (dial.DefaultAdd > 0)
             {
                 isDefaultAdd  = true;
                 panelName     = "CustomPanel";
                 txt_Name.text = dial.Name;
             }
         }
     }
 }
    public void _SetComponetBasic()
    {
        this.m_dtTotalBG         = (base.GetControl("DrawTexture_TotalBG") as DrawTexture);
        this.m_dtTopBG           = (base.GetControl("DrawTexture_DrawTexture3") as DrawTexture);
        this.m_waitImg           = (base.GetControl("DrawTexture_Loading") as DrawTexture);
        this.m_dtTotalBG.Visible = false;
        this.m_dtTopBG.Visible   = false;
        this.m_waitImg.Visible   = false;
        string    path    = string.Format("{0}Texture/Loading/0{1}", NrTSingleton <UIDataManager> .Instance.FilePath, NrTSingleton <UIDataManager> .Instance.AddFilePath);
        Texture2D texture = (Texture2D)CResources.Load(path);

        this.m_dtTotalBG.SetTexture(texture);
        this.BattleScenarioUnique = Battle.BATTLE.GetScenarioUnique();
        base.ShowBlackBG(1f);
        if (null != base.BLACK_BG)
        {
            base.BLACK_BG.RemoveValueChangedDelegate(new EZValueChangedDelegate(this.CloseForm));
        }
    }
    /// <summary>
    /// 同步加载
    /// </summary>
    public void Load()
    {
        var o = CResources.Load <GameObject>(resourcePath);

        if (o == null)
        {
            Debug.LogError("窗口资源不存在:" + resourcePath);
            return;
        }

        var go = GameObject.Instantiate(o);

        Transform = go.transform;
        Transform.gameObject.SetActive(false);
        IsLoad = true;
        //自动查找节点
        UITools.AutoSetTransformPath(this);
        Init();
    }
Beispiel #25
0
    private void ParseToolTip()
    {
        string    path      = NrTSingleton <UIDataManager> .Instance.FilePath + "TextPreloading/LoadingToolTip";
        TextAsset textAsset = (TextAsset)CResources.Load(path);

        if (null == textAsset)
        {
            TsLog.Log("Failed TextPreloading/LoadingToolTip", new object[0]);
            return;
        }
        char[] separator = new char[]
        {
            '\t'
        };
        string[] array = textAsset.text.Split(new char[]
        {
            '\n'
        });
        for (int i = 1; i < array.Length; i++)
        {
            if (!(string.Empty == array[i]))
            {
                string[]       array2         = array[i].Split(separator);
                NewLoadingText newLoadingText = new NewLoadingText();
                newLoadingText.m_szTextKey = array2[0];
                newLoadingText.m_nMinLV    = int.Parse(array2[1]);
                newLoadingText.m_nMaxLV    = int.Parse(array2[2]);
                if (UIDataManager.IsUse256Texture())
                {
                    newLoadingText.m_szBundlePath = array2[4];
                }
                else
                {
                    newLoadingText.m_szBundlePath = array2[3];
                }
                newLoadingText.m_nShowType = int.Parse(array2[5]);
                this.m_LoadingText.Add(newLoadingText);
            }
        }
        Resources.UnloadAsset(textAsset);
        CResources.Delete(path);
    }
        public static UIButton Button(string name, string imageKey, float width, float height)
        {
            UIBaseInfoLoader uIBaseInfoLoader = UIBaseFileManager.FindUIImageDictionary(name, imageKey);

            if (uIBaseInfoLoader == null)
            {
                return(null);
            }
            GameObject gameObject = new GameObject(name);
            UIButton   uIButton   = gameObject.AddComponent <UIButton>();

            uIButton.gameObject.layer = GUICamera.UILayer;
            uIButton.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT);
            uIButton.SetSpriteTile(uIBaseInfoLoader.Tile, uIBaseInfoLoader.UVs.width / (float)uIBaseInfoLoader.ButtonCount, uIBaseInfoLoader.UVs.height);
            Material material = (Material)CResources.Load(uIBaseInfoLoader.Material);

            uIButton.Setup(width, height, material);
            float pixelToUVsWidth = UIBaseFileManager.GetPixelToUVsWidth(material, uIBaseInfoLoader.UVs.width / (float)uIBaseInfoLoader.ButtonCount);
            Rect  rect            = new Rect(UIBaseFileManager.GetPixelToUVsWidth(material, uIBaseInfoLoader.UVs.x) - pixelToUVsWidth, 1f - UIBaseFileManager.GetPixelToUVsHeight(material, uIBaseInfoLoader.UVs.y + uIBaseInfoLoader.UVs.height), pixelToUVsWidth, UIBaseFileManager.GetPixelToUVsHeight(material, uIBaseInfoLoader.UVs.height));
            Rect  uvs             = new Rect(rect);

            uvs.x += pixelToUVsWidth;
            for (int i = 0; i < (int)uIBaseInfoLoader.ButtonCount; i++)
            {
                uIButton.States[i].spriteFrames    = new CSpriteFrame[1];
                uIButton.States[i].spriteFrames[0] = new CSpriteFrame();
                rect.x += pixelToUVsWidth;
                if ((int)uIBaseInfoLoader.ButtonCount <= i)
                {
                    uIButton.States[i].spriteFrames[0].uvs = uvs;
                }
                else
                {
                    uIButton.States[i].spriteFrames[0].uvs = rect;
                }
                uIButton.animations[i].SetAnim(uIButton.States[i], i);
            }
            uIButton.autoResize = false;
            uIButton.Start();
            return(uIButton);
        }
Beispiel #27
0
    void OnGUI()
    {
        if (GUILayout.Button("Unload"))
        {
            UnityEngine.SceneManagement.SceneManager.LoadScene("good");
        }


        if (GUILayout.Button("UnloadUnusedAssets"))
        {
            CResources.UnloadUnusedAssets().completed += (p) =>
            {
                GameObject obj2 = CResources.Load <GameObject>("A/Cube");

                LogUtility.Log(obj2);
            };
        }


        if (GUILayout.Button("Load"))
        {
        }
    }
 public void SetBattleSkillTextureMaterial(WWWItem _item, object _param)
 {
     if (this == null)
     {
         return;
     }
     if (_item.isCanceled)
     {
         return;
     }
     if (_item.GetSafeBundle() != null && null != _item.GetSafeBundle().mainAsset)
     {
         Texture2D texture2D = _item.GetSafeBundle().mainAsset as Texture2D;
         if (null != texture2D)
         {
             Material material = (Material)CResources.Load(NrTSingleton <UIDataManager> .Instance.GetString(UIDataManager.filePath, "Material/BattleSkill_Icon/BattleSkill001_mobile"));
             if (null != material)
             {
                 material.mainTexture = texture2D;
             }
         }
     }
 }
        public static Emoticon EmoticonCharChat(string name, float emoticonWidth, float emoticonHeight, string emoticonKey)
        {
            GameObject gameObject = new GameObject(name);
            Emoticon   emoticon   = gameObject.AddComponent <Emoticon>();

            emoticon.SetUseBoxCollider(false);
            emoticon.gameObject.layer = GUICamera.UILayer;
            emoticon.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT);
            emoticon.AutoAnimatorStop = false;
            UIEmoticonInfo uIEmoticonInfo = NrTSingleton <UIEmoticonManager> .Instance.FindUIEmoticonDictionary(emoticonKey);

            if (uIEmoticonInfo != null)
            {
                emoticon.SetDelay(uIEmoticonInfo.delays);
                UIBaseInfoLoader infoLoader = uIEmoticonInfo.infoLoader;
                if (infoLoader == null)
                {
                    return(emoticon);
                }
                emoticon.SetSpriteTile(infoLoader.Tile, infoLoader.UVs.width / (float)infoLoader.ButtonCount, infoLoader.UVs.height);
                Material material = (Material)CResources.Load(infoLoader.Material);
                emoticon.Setup(emoticonWidth, emoticonHeight, material);
                float pixelToUVsWidth = UIBaseFileManager.GetPixelToUVsWidth(material, infoLoader.UVs.width / (float)infoLoader.ButtonCount);
                Rect  uvs             = new Rect(UIBaseFileManager.GetPixelToUVsWidth(material, infoLoader.UVs.x) - pixelToUVsWidth, 1f - UIBaseFileManager.GetPixelToUVsHeight(material, infoLoader.UVs.y + infoLoader.UVs.height), pixelToUVsWidth, UIBaseFileManager.GetPixelToUVsHeight(material, infoLoader.UVs.height));
                for (int i = 0; i < 3; i++)
                {
                    emoticon.States[i].spriteFrames    = new CSpriteFrame[1];
                    emoticon.States[i].spriteFrames[0] = new CSpriteFrame();
                    uvs.x += pixelToUVsWidth;
                    emoticon.States[i].spriteFrames[0].uvs = uvs;
                    emoticon.animations[i].SetAnim(emoticon.States[i], i);
                }
                emoticon.autoResize = false;
            }
            return(emoticon);
        }
Beispiel #30
0
    private void createInputContent(int index)
    {
        CUIInput inputContentWidget = null;

        if (tempInputContents.Count > index)
        {
            inputContentWidget = tempInputContents[index];
        }
        else
        {
            var o = CResources.Load <GameObject>("Views/InputContent");
            if (o == null)
            {
                Debugger.LogError("加载InputContent失败");
                return;
            }
            var obj = GameObject.Instantiate(o, Vector3.zero, Quaternion.identity, tf_Content.transform);
            inputContentWidget = new CUIInput(obj.transform);
            inputContentWidget.Init();
            obj.transform.localScale    = Vector3.one;
            obj.transform.localPosition = Vector3.zero;
            tempInputContents.Add(inputContentWidget);
        }
    }