예제 #1
0
 public virtual void Awake()
 {
     this.go         = this.gameObject;
     this.mTransform = this.transform;
     chatacters1_obj = mTransform.Find("UI_bg/chatacters1_obj").gameObject;
     characters1_obj = mTransform.Find("UI_bg/chatacters1_obj/characters1_obj").gameObject;
     characters2_obj = mTransform.Find("UI_bg/chatacters1_obj/characters2_obj").gameObject;
     chatacters2_obj = mTransform.Find("UI_bg/chatacters2_obj").gameObject;
     characters1_obj = mTransform.Find("UI_bg/chatacters2_obj/characters1_obj").gameObject;
     characters2_obj = mTransform.Find("UI_bg/chatacters2_obj/characters2_obj").gameObject;
     chatacters3_obj = mTransform.Find("UI_bg/chatacters3_obj").gameObject;
     characters1_obj = mTransform.Find("UI_bg/chatacters3_obj/characters1_obj").gameObject;
     characters2_obj = mTransform.Find("UI_bg/chatacters3_obj/characters2_obj").gameObject;
     format_obj      = mTransform.Find("stubobjs/format_obj").gameObject;
     stub_obj        = mTransform.Find("stubobjs/stub_obj").gameObject;
     heros_obj       = mTransform.Find("stubobjs/stub_obj/heros_obj").gameObject;
     herogrid_obj    = mTransform.Find("stubobjs/stub_obj/heros_obj/viewport/herogrid_obj").gameObject;
     StubPos_obj     = mTransform.Find("stubobjs/stub_obj/StubPos_obj").gameObject;
     StubShow_obj    = mTransform.Find("stubobjs/stub_obj/StubShow_obj").gameObject;
     StubShow_bb     = mTransform.Find("stubobjs/stub_obj/StubShow_obj/StubShow_bb").GetComponent <UIBillboard>();
     StubCommit_btn  = mTransform.Find("stubobjs/stub_obj/StubCommit_btn").GetComponent <Button>();
     fightpower_txt  = mTransform.Find("stubobjs/stub_obj/fightpower/fightpower_txt").GetComponent <Text>();
     Tabs_obj        = mTransform.Find("Tabs_obj").gameObject;
     Stub_tog        = mTransform.Find("Tabs_obj/Stub_tog").GetComponent <Toggle>();
     Format_tog      = mTransform.Find("Tabs_obj/Format_tog").GetComponent <Toggle>();
     StubDrag_bb     = mTransform.Find("StubDrag_bb").GetComponent <UIBillboard>();
 }
예제 #2
0
 private void _setStubHero(int stubPos, bool isCreate = false, int heroId = 0)
 {
     //不管是创建还是删除,都得先删除了
     if (_stubHeroDic.ContainsKey(stubPos))
     {
         DestroyImmediate(_stubHeroDic[stubPos]);
         _stubHeroDic.Remove(stubPos);
         _stubPosDic[stubPos].SetStubState(StubState.Open);
     }
     if (isCreate)
     {
         UIBillboard _bb = null;
         if (0 == stubPos)
         {
             _bb = StubDrag_bb;
         }
         else
         {
             _bb = StubShow_bb;
         }
         if (_bb == null)
         {
             EDebug.LogErrorFormat("StubView._setStubHero error, stubPos:{0}", stubPos);
             return;
         }
         Hero       heroData = JsonMgr.GetSingleton().GetHeroByID(heroId);
         GameObject heroGo   = null;
         if (stubPos != 0)
         {
             int stubX = stubPos / 10;
             int stubY = stubPos % 10;
             heroGo = GameObject.Instantiate(ResourceMgr.Instance.LoadResource(heroData.ID) as GameObject,
                                             _bb.GetCamPos() + new Vector3((stubX - 1) * StubXSpace3D + (6 - stubY) * LeanOffset3D - 15f,
                                                                           (6 - stubY) * StubYSpace3D - 11f, 5), Quaternion.Euler(0, 125.75f, 0));
             heroGo.transform.localScale = Vector3.one * 1.8f;
         }
         else
         {
             heroGo = GameObject.Instantiate(ResourceMgr.Instance.LoadResource(heroData.ID) as GameObject,
                                             _bb.GetCamPos() + new Vector3(0, 0, 5),
                                             Quaternion.Euler(0, 125.75f, 0));
         }
         if (heroGo != null)
         {
             _stubHeroDic.Add(stubPos, heroGo);
             if (heroData.horseid != 0)
             {
                 GameObject horseGo = GameObject.Instantiate(ResourceMgr.Instance.LoadResource(heroData.horseid) as GameObject, heroGo.transform);
                 horseGo.transform.localPosition = Vector3.zero;
                 horseGo.transform.localScale    = Vector3.one;
             }
             heroGo.SetLayer(_bb.Layer);
         }
         else
         {
             EDebug.LogErrorFormat("StubView._setStubHero error, load heroGo failed, heroId:{0}", heroData.ID);
         }
         _stubPosDic[stubPos].SetStubState(StubState.Stubed);
     }
 }
예제 #3
0
    public override void Awake()
    {
        base.Awake();
        instantiate = new Dictionary <HeroData, GameObject>();

        typeTr = new Dictionary <EHEROSHOWTYPE, Transform>
        {
            { EHEROSHOWTYPE.Card, Card_trf },
            { EHEROSHOWTYPE.Officer, Officer_trf },
            { EHEROSHOWTYPE.Divination, Divination_trf },
            { EHEROSHOWTYPE.Skill, Skill_trf },
            { EHEROSHOWTYPE.Relation, Relation_trf },
            { EHEROSHOWTYPE.Detail, Detail_trf }
        };
        foreach (var item in typeTr)
        {
            item.Value.SetParent(Hide_trf);
        }

        //图片分类
        imageType = new Dictionary <GameObject, EHEROSHOWTYPE>
        {
            { card_img.gameObject, EHEROSHOWTYPE.Card },
            { officer_img.gameObject, EHEROSHOWTYPE.Officer },
            { divination_img.gameObject, EHEROSHOWTYPE.Divination },
            { skill_img.gameObject, EHEROSHOWTYPE.Skill },
            { relation_img.gameObject, EHEROSHOWTYPE.Relation },
            { detail_img.gameObject, EHEROSHOWTYPE.Detail }
        };

        crArray    = Star_obj.GetComponentsInChildren <CanvasRenderer>();
        glg        = LeftContent_obj.GetComponent <GridLayoutGroup>();
        rect       = LeftContent_obj.GetComponent <RectTransform>();
        sr         = Scroll_obj.GetComponent <ScrollRect>();
        scrollRect = Template_obj.GetComponent <ScrollRect>();
        officerrt  = OfficerList_obj.GetComponent <RectTransform>();
        billboard  = hero_obj.GetComponent <UIBillboard>();

        TriggerListener();

        officerText = DownContent_obj.GetComponentsInChildren <Text>();

        for (int i = 0; i < officerText.Length; i++)
        {
            Text text = officerText[i];
            EventListener.Get(text.gameObject).BegineDragEvent = e =>
            {
                scrollRect.OnBeginDrag(e);
            };
            EventListener.Get(text.gameObject).DragEvent = e =>
            {
                scrollRect.OnDrag(e);
            };
            EventListener.Get(text.gameObject).EndDragEvent = e =>
            {
                scrollRect.OnEndDrag(e);
            };
        }

        skillImage    = new Image[4];
        skillImage[0] = skill1_img;
        skillImage[1] = skill2_img;
        skillImage[2] = skill3_img;
        skillImage[3] = skill4_img;
    }