Example #1
0
        protected void SetObserverPlayerNameData(IUIDataManager uiDataManager)
        {
            allObserverNameData = uiDataManager.AllObserverNameData;
            if (allObserverNameData.Changed)
            {
                allObserverNameData.Changed = false;

                var length = allObserverNameData.NameList.Count;
                if (length > 0)
                {
                    observerPlayerBackImage.visible = true;
                }
                else
                {
                    observerPlayerBackImage.visible = false;
                }

                for (var i = 0; i < length; ++i)
                {
                    if (i > ObserverPlayerH * ObserverPlayerV)
                    {
                        break;
                    }

                    UnityUiUtility.SetTexture(observerPlayerName[i], allObserverNameData.NameList[i]);
                    observerPlayerName[i].visible = true;
                }

                length = observerPlayerName.Count;
                for (var i = 0; i < length; ++i)
                {
                    observerPlayerName[i].visible = false;
                }
            }
        }
Example #2
0
        public object Frame(int frameTime)
        {
            if (parentGround == null)
            {
                parentGround = UnityUiUtility.FindUIObject(GroundParentPath);
            }

            if (parentBag == null)
            {
                parentBag = UnityUiUtility.FindUIObject(BagParentPath);
            }

            InitialBag();

            SimpleFreeUI bag = SingletonManager.Get <FreeUiManager>().GetUi("bagSystemUI");

            if (bag.Visible != isOpen)
            {
                if (!bag.Visible)
                {
                    SingletonManager.Get <FreeUiManager>().Contexts1.ui.uI.IsShowCrossHair = true;
                    SingletonManager.Get <FreeUiManager>().Contexts1.userInput.userInputManager.Helper.UnblockKey(bagBlockKeyId);
                    SingletonManager.Get <FreeUiManager>().Contexts1.userInput.userInputManager.Helper.UnblockPointer(bagBlockPointerId);
                }
                else
                {
                    SingletonManager.Get <FreeUiManager>().Contexts1.ui.uI.IsShowCrossHair = false;
                    bagBlockKeyId     = SingletonManager.Get <FreeUiManager>().Contexts1.userInput.userInputManager.Helper.BlockKey(UserInputManager.Lib.Layer.Ui);
                    bagBlockPointerId = SingletonManager.Get <FreeUiManager>().Contexts1.userInput.userInputManager.Helper.BlockPointer(UserInputManager.Lib.Layer.Ui);
                }
                isOpen = bag.Visible;

                if (CursorLocker.SystemUnlock)
                {
                    //Unlock
                    SingletonManager.Get <FreeUiManager>().Contexts1.ui.uI.IsShowCrossHair = false;
                    CursorLocker.SystemBlockKeyId     = SingletonManager.Get <FreeUiManager>().Contexts1.userInput.userInputManager.Helper.BlockKey(UserInputManager.Lib.Layer.System);
                    CursorLocker.SystemBlockPointerId = SingletonManager.Get <FreeUiManager>().Contexts1.userInput.userInputManager.Helper.BlockPointer(UserInputManager.Lib.Layer.System);
                }
            }

            if (bag.Visible)
            {
                FreePrefabLoader.CacheGameObject(new AssetInfo("ui/client/prefab/chicken", "ItemBar"), 50);
                FreePrefabLoader.CacheGameObject(new AssetInfo("ui/client/prefab/chicken", "CaseNameBar"), 5);

                if (parentGround != null && parentBag != null && DateTime.Now.Ticks - lastUpdateTime > 10000)
                {
                    lastUpdateTime = DateTime.Now.Ticks;

                    Contexts context = SingletonManager.Get <FreeUiManager>().Contexts1;

                    PlayerEntity player = context.player.flagSelfEntity;

                    RefreshGround(context, player);
                    RefreshBag(context, player);
                }
            }
            return(null);
        }
Example #3
0
 private void AddEvent(string v)
 {
     if (!string.IsNullOrEmpty(v))
     {
         string[] fieldEvents = v.Split(FreeMessageConstant.SpliterRecord);
         foreach (string fieldEvent in fieldEvents)
         {
             string[] vs = fieldEvent.Split(FreeMessageConstant.SpilterField);
             if (vs.Length == 3)
             {
                 GameObject obj = UnityUiUtility.FindUIObject(currentObject, vs[0].Trim());
                 if (obj != null)
                 {
                     Graphic gra = obj.GetComponent <Graphic>();
                     if (gra != null)
                     {
                         if (gra is RawImage || gra is Image || gra is Text)
                         {
                             ItemComponent item = obj.AddComponent <ItemComponent>();
                             item.EventKey = vs[1].Trim();
                             AddEvent(obj, int.Parse(vs[2].Trim()));
                         }
                     }
                 }
             }
         }
     }
 }
Example #4
0
        public FreePrefabComponent()
        {
            _uiObject = UnityUiUtility.CreateEmptyDisplayObject("Prefab");
            RectTransform rt = _uiObject.gameObject.GetComponent <RectTransform>();

            FreeLayoutConverter.FullScreen(rt);

            this.valueList = new HashSet <string>();
        }
Example #5
0
        public void Handle(SimpleProto data)
        {
            Contexts contexts = SingletonManager.Get <FreeUiManager>().Contexts1;
            string   uiKey    = data.Ss[0];

            GameObject obj = UnityUiUtility.FindUIObject(uiKey);

            if (obj != null)
            {
                Image[] imgs = obj.GetComponentsInChildren <Image>();
                foreach (Image img in imgs)
                {
                }
            }
        }
Example #6
0
        private void ReturnObject(ItemBar bar)
        {
            FreePrefabComponent prefab = bar.prefab;
            GameObject          obj    = (GameObject)prefab.currentObject;

            if (obj != null)
            {
                obj.GetComponent <Transform>().parent = null;
                FreePrefabLoader.ReturnGameObject(obj, prefab.assetInfo);

                string   imgUrl      = "";
                string[] fieldValues = bar.value.Split(FreeMessageConstant.SpliterRecord);

                foreach (string fieldValue in fieldValues)
                {
                    string[] vs = fieldValue.Split(FreeMessageConstant.SpilterField);
                    if (vs.Length == 2)
                    {
                        if (vs[0].Trim() == "IMG_WeaponIcon")
                        {
                            imgUrl = vs[1].Trim();
                        }
                    }
                }

                GameObject img = UnityUiUtility.FindUIObject(obj, "IMG_WeaponIcon");
                if (img != null && !string.IsNullOrEmpty(imgUrl))
                {
                    int       last       = imgUrl.Trim().LastIndexOf("/");
                    string    buddleName = imgUrl.Trim().Substring(0, last);
                    string    assetName  = imgUrl.Trim().Substring(last + 1);
                    AssetInfo info       = new AssetInfo(buddleName, assetName);

                    Graphic gra = img.GetComponent <Graphic>();
                    if (gra is Image)
                    {
                        FreeUILoader.ReturnGameObject(((Image)gra).sprite, info);
                    }
                    if (gra is RawImage)
                    {
                        FreeUILoader.ReturnGameObject(((RawImage)gra).texture, info);
                    }
                }
            }
        }
Example #7
0
        private void UpdateExpImage()
        {
            var length = profitData.expPlusList.Count;
            var index  = 0;

            for (var i = 0; i < length; ++i)
            {
                if (profitData.expPlusList[i] > 0)
                {
                    expImageList[index].visible = true;
                    UnityUiUtility.SetTexture(expImageList[index], GetCommonUrl(expUrlList[i]));

                    expSpriteList[index].visible = true;
                    SetNumber(expSpriteList[index], profitData.expPlusList[i]);
                    index++;
                }
            }
        }
Example #8
0
        private void SetOneValue(string[] vs)
        {
            GameObject obj = UnityUiUtility.FindUIObject(currentObject, vs[0].Trim());

            if (obj != null)
            {
                Graphic gra = obj.GetComponent <Graphic>();
                if (gra != null)
                {
                    if (gra is Text)
                    {
                        ((Text)gra).text = vs[1].Trim();
                    }

                    if (gra is RawImage || gra is Image)
                    {
                        if (string.IsNullOrEmpty(vs[1]))
                        {
                            if (gra is RawImage)
                            {
                                ((RawImage)gra).texture = ResourceUtility.GetTransparentTexture();
                            }
                            if (gra is Image)
                            {
                                Texture2D tex = ResourceUtility.GetTransparentTexture();
                                ((Image)gra).sprite = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), Vector2.zero);
                            }
                        }
                        else
                        {
                            int    last       = vs[1].Trim().LastIndexOf("/");
                            string buddleName = vs[1].Trim().Substring(0, last);
                            string assetName  = vs[1].Trim().Substring(last + 1);
                            FreeUILoader.Load(gra, buddleName, assetName);
                        }
                    }
                }
            }
        }
Example #9
0
        private void SetWeight()
        {
            GameObject weight = UnityUiUtility.FindUIObject("SelfitemPanel/TEXT_Weight");

            if (weight != null)
            {
                Text text = weight.GetComponent <Text>();
                if (text != null)
                {
                    text.text = CurrentBag.Ks[2] + "/" + CurrentBag.Ks[1];
                }
            }

            weight = UnityUiUtility.FindUIObject("GrounditemPanel/TEXT_CaseName");
            if (weight != null)
            {
                Text text = weight.GetComponent <Text>();
                if (text != null)
                {
                    text.text = "";
                }
            }
        }
Example #10
0
        private void IniOb()
        {
            observerPlayerBackImage = UnityUiUtility.CreateImageDisplayObject(GetCommonUrl("observerPlayer/allKillInfoObserverPlayerBack.atf"), 700, 84);
            _uiObject.AddChild(observerPlayerBackImage);
            observerPlayerBackImage.x = 73;
            observerPlayerBackImage.y = 0;

            var index = 0;

            for (var i = 0; i < ObserverPlayerH; ++i)
            {
                for (var j = 0; j < ObserverPlayerV; ++j)
                {
                    var nameObj = UnityUiUtility.CreateEmptyDisplayObject();//UnityUIUtility.CreateImageDisplayObject("1", 128, 32);
                    _uiObject.AddChild(nameObj);
                    observerPlayerName.Add(nameObj);

                    nameObj.x       = (observerPlayerBackImage.x + 15 + j * 130);
                    nameObj.y       = (observerPlayerBackImage.y + 20 + i * 20);
                    nameObj.visible = false;
                    index++;
                }
            }
        }
Example #11
0
        private void OnBeginCloneDelegate(PointerEventData eventData)
        {
            if (dragObj == null)
            {
                dragObj = new GameObject();
                RectTransform t = dragObj.AddComponent <RectTransform>();
                dragObj.AddComponent <ItemComponent>();
                dragObj.AddComponent <Image>();
            }

            ItemComponent item = dragObj.GetComponent <ItemComponent>();

            item.EventKey = eventData.pointerDrag.GetComponent <ItemComponent>().EventKey;
            Image pointerImg = eventData.pointerDrag.GetComponent <Image>();

            Texture2D tex = null;

            if (pointerImg != null)
            {
                tex = (Texture2D)pointerImg.mainTexture;
            }

            GameObject clone = UnityUiUtility.FindUIObject(this.currentObject, "IMG_WeaponIcon");

            if (clone != null && this.name == "bag/ItemBar")
            {
                tex = (Texture2D)clone.GetComponent <Image>().mainTexture;
            }
            Image img = dragObj.GetComponent <Image>();

            img.sprite        = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), Vector2.zero);
            img.raycastTarget = false;

            dragObj.transform.position = eventData.position;
            dragObj.transform.parent   = UnityUiUtility.RootCanvas.transform;
        }
Example #12
0
        private void IniExp()
        {
            profitBackImage = UnityUiUtility.CreateImageDisplayObject(GetCommonUrl("killList/profitback.atf"), 845, 142);
            _uiObject.AddChild(profitBackImage);
            profitBackImage.x       = 0;
            profitBackImage.y       = 0;
            profitBackImage.visible = false;


            totalExpSprite = UnityUiUtility.CreateEmptyDisplayObject();
            _uiObject.AddChild(totalExpSprite);
            totalExpSprite.x       = profitBackImage.x + 110;
            totalExpSprite.y       = profitBackImage.y + 47;
            totalExpSprite.visible = false;


            totalExpPerSprite = UnityUiUtility.CreateEmptyDisplayObject();
            _uiObject.AddChild(totalExpPerSprite);
            totalExpPerSprite.x       = totalExpSprite.x + 80;
            totalExpPerSprite.y       = totalExpSprite.y + 3;
            totalExpPerSprite.visible = false;


            totalGpSprite = UnityUiUtility.CreateEmptyDisplayObject();
            _uiObject.AddChild(totalGpSprite);
            totalGpSprite.x       = totalExpSprite.x + 325;
            totalGpSprite.y       = profitBackImage.y + 45;
            totalGpSprite.visible = false;

            totalGpPerSprite = UnityUiUtility.CreateEmptyDisplayObject();
            _uiObject.AddChild(totalGpPerSprite);
            totalGpPerSprite.x       = totalGpSprite.x + 80;
            totalGpPerSprite.y       = totalGpSprite.y + 3;
            totalGpPerSprite.visible = false;

            totalCrystalSprite = UnityUiUtility.CreateEmptyDisplayObject();
            _uiObject.AddChild(totalCrystalSprite);
            totalCrystalSprite.x       = profitBackImage.x + 770;
            totalCrystalSprite.y       = profitBackImage.y + 76;
            totalCrystalSprite.visible = false;

//            for (var i = 0; i < 4; ++i)
//
//            {
            totalExpSprite.AddChild(UnityUiUtility.CreateNumberTextDisplayObject(120));
            totalExpPerSprite.AddChild(UnityUiUtility.CreateNumberTextDisplayObject(130));
            totalGpSprite.AddChild(UnityUiUtility.CreateNumberTextDisplayObject(120));
            totalGpPerSprite.AddChild(UnityUiUtility.CreateNumberTextDisplayObject(130));
            totalCrystalSprite.AddChild(UnityUiUtility.CreateNumberTextDisplayObject(120));
//            }

            expImageList  = new List <IUiObject>();
            expSpriteList = new List <IUiObject>();
            for (var i = 0; i < 6; ++i)
            {
                var expImageObj = UnityUiUtility.CreateImageDisplayObject(GetCommonUrl("killList/honorary.atf"), 40, 49);
                expImageList.Add(expImageObj);
                _uiObject.AddChild(expImageObj);
                expImageObj.x = profitBackImage.x + 50 + (expImageObj.width + 10) * i;
                expImageObj.y = profitBackImage.y + 85;

                expImageObj.visible = false;

                var expSpriteObj = UnityUiUtility.CreateEmptyDisplayObject();
                expSpriteList.Add(expSpriteObj);
                _uiObject.AddChild(expSpriteObj);
                expSpriteObj.x       = expImageObj.x + 2;
                expSpriteObj.y       = expImageObj.y + 35;
                expSpriteObj.visible = false;

//                for (var j = 0; j < 4; ++j)
//                {
                expSpriteObj.AddChild(UnityUiUtility.CreateNumberTextDisplayObject(140));
//                }
            }

            gpImageList  = new List <IUiObject>();
            gpSpriteList = new List <IUiObject>();
            for (var i = 0; i < 4; ++i)
            {
                var gpImageObj = UnityUiUtility.CreateImageDisplayObject(GetCommonUrl("killList/honorary.atf"), 100, 100);
                gpImageList.Add(gpImageObj);
                _uiObject.AddChild(gpImageObj);
                gpImageObj.x = profitBackImage.x + 420 + (gpImageObj.width + 10) * i;
                gpImageObj.y = profitBackImage.y + 85;

                gpImageObj.visible = false;


                var gpSpriteObj = UnityUiUtility.CreateEmptyDisplayObject();
                gpSpriteList.Add(gpSpriteObj);
                _uiObject.AddChild(gpSpriteObj);
                gpSpriteObj.x       = gpImageObj.x + 2;
                gpSpriteObj.y       = gpImageObj.y + 35;
                gpSpriteObj.visible = false;


//                for (var j = 0; j < 4; ++j)
//
//                {
                gpSpriteObj.AddChild(UnityUiUtility.CreateNumberTextDisplayObject(140));
//                }
            }

            expUrlList = new List <string>();
            expUrlList.Add("killList/honorary.atf");
            expUrlList.Add("killList/heroweapon.atf");
            expUrlList.Add("killList/bigexp.atf");
            expUrlList.Add("killList/smallexp.atf");
            expUrlList.Add("killList/friend.atf");
            expUrlList.Add("killList/accessory.atf");

            gpUrlList = new List <string>();
            gpUrlList.Add("killList/honorary.atf");
            gpUrlList.Add("killList/heroweapon.atf");
            gpUrlList.Add("killList/biggp.atf");
            gpUrlList.Add("killList/smallgp.atf");
        }
 private static GameObject GetGameObject(int key, string part)
 {
     return(UnityUiUtility.FindUIObject("WeaponSlot" + key + "/VISIBLE_WeaponPartSlot" + part));
 }
        //    private FreeSmallMap smallMap;

        public FreeSmallMapComponent()
        {
            _uiObject = UnityUiUtility.CreateEmptyDisplayObject("SmallMap");
        }
        //        private FreeRader rader;

        public FreeRaderComponent()
        {
            _uiObject = UnityUiUtility.CreateEmptyDisplayObject("Rader");
        }