Esempio n. 1
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);
        }
Esempio n. 2
0
        public static void ShowTopTip(string msg)
        {
            SimpleFreeUI ui = SingletonManager.Get <FreeUiManager>().GetUi("upTipUI");

            if (ui != null && !StringUtil.IsNullOrEmpty(msg))
            {
                FreePrefabComponent txt = (FreePrefabComponent)ui.GetComponent(0);
                txt.SetFieldValue("Content", msg);

                ui.Show(5000);
            }
        }
Esempio n. 3
0
    public void SetValue(int currentTime, int totalTime, SimpleFreeUI ui)
    {
        if (currentTime >= FromTime && currentTime <= ToTime)
        {
            var delta = FromValue + (ToValue - FromValue) * (currentTime - FromTime) / (ToTime - FromTime);

            if (FromValue < 0)
            {
                delta = ToValue * (currentTime - FromTime) / (ToTime - FromTime);
            }

            if (Field == "x")
            {
                ui.X = ui.OrignalX + delta;
            }
            if (Field == "y")
            {
                ui.Y = ui.OrignalY + delta;
            }
            if (Field == "w")
            {
                ui.Width = (int)(ui.OrignalWidth + delta);
            }
            if (Field == "h")
            {
                ui.Height = (int)(ui.OrignalHeight + delta);
            }
            if (Field == "a")
            {
                ui.Alpha = delta;
            }
            if (Field == "s")
            {
                ui.Width  = (int)(ui.OrignalWidth * delta);
                ui.Height = (int)(ui.OrignalHeight * delta);

                ui.X = ui.OrignalX + (ui.OrignalWidth * (1 - delta));
                ui.Y = ui.OrignalY + (ui.OrignalHeight * (1 - delta));
            }
        }
    }