コード例 #1
0
        private void ClearQuestTable()
        {
            if (questTable == null)
            {
                return;
            }
            List <Transform> delete = new List <Transform>();

            foreach (Transform child in questTable.transform)
            {
                if (child.gameObject.activeSelf)
                {
                    delete.Add(child);
                }
            }
            delete.ForEach(c => NGUITools.Destroy(c.gameObject));
        }
コード例 #2
0
    //播完销毁,可点
    public void UnLockFinish()
    {
        if (unLockEffect != null)
        {
            NGUITools.Destroy(unLockEffect);
            unLockEffect = null;
        }
        UnityEngine.BoxCollider box = gameObject.GetComponent <UnityEngine.BoxCollider>();
        UIButton button             = gameObject.GetComponent <UIButton>();

        if (box != null && button != null)
        {
            button.isEnabled = true;
            button.enabled   = true;
            box.enabled      = true;
        }
    }
コード例 #3
0
ファイル: FriendItem.cs プロジェクト: tomneo2004/StrategyGame
    /// <summary>
    /// Handle action confirm event.
    /// </summary>
    /// <param name="buttonIndex">Button index.</param>
    void OnActionConfirm(int buttonIndex)
    {
        if (buttonIndex == 0)
        {
            FriendListMetaData data = FriendListMetaData.Load();
            data.RemoveFriend(friendId);

            transform.parent = null;

            NGUITools.Destroy(gameObject);

            if (Evt_OnFriendItemDelete != null)
            {
                Evt_OnFriendItemDelete();
            }
        }
    }
コード例 #4
0
    private static void AdjustDepth()
    {
        var panel   = UnityEditor.Selection.activeTransform.GetComponent <UIPanel>();
        var widgets = GetPanelWidgets(panel, false);

        DepthCalculatorBindingAlgorithm.BindToWidgets(widgets);
        UnityEditor.Undo.RecordObjects(widgets, "AdjustDepth");
        DepthCalculationAlgorithm.CalculateDepthForWidgets(widgets);
        foreach (var w in widgets)
        {
            var c = w.GetComponent <DepthCalculator>();
            if (c != null)
            {
                NGUITools.Destroy(c);
            }
        }
    }
コード例 #5
0
    void Replace()
    {
        UIWidget widget = GetComponentInChildren <UIWidget>();

        if (widget == null)
        {
            Debug.LogError("Widget placeholder can not be used without widget.");
        }
        GameObject obj        = GameObject.Instantiate(prefab) as GameObject;
        UIWidget   new_widget = obj.GetComponentInChildren <UIWidget>();

        if (new_widget == null)
        {
            Debug.LogError("The prefab isn't a widget.");
        }
        obj.name                    = gameObject.name;
        obj.transform.parent        = transform.parent;
        obj.transform.localPosition = transform.localPosition;
        obj.transform.localRotation = transform.localRotation;
        obj.transform.localScale    = transform.localScale;
        new_widget.alpha            = widget.alpha;
        Bounds bounds = widget.CalculateBounds(transform.parent);

        new_widget.SetRect(bounds.min.x, bounds.min.y, bounds.size.x, bounds.size.y);
        new_widget.width           = widget.width;
        new_widget.height          = widget.height;
        new_widget.aspectRatio     = widget.aspectRatio;
        new_widget.keepAspectRatio = widget.keepAspectRatio;
        new_widget.leftAnchor      = widget.leftAnchor;
        new_widget.rightAnchor     = widget.rightAnchor;
        new_widget.topAnchor       = widget.topAnchor;
        new_widget.bottomAnchor    = widget.bottomAnchor;
        new_widget.ResetAnchors();
        new_widget.UpdateAnchors();
        NGUITools.AdjustDepth(new_widget.gameObject, widget.depth - new_widget.depth);
        UIPanel panel = GetComponent <UIPanel>();

        if (panel != null)
        {
            UIPanel new_panel = obj.GetComponent <UIPanel>();
            NGUITools.AdjustDepth(new_panel.gameObject, panel.depth - new_panel.depth);
        }
        NGUITools.Destroy(gameObject);
        gameObject.SetActive(false);            //TODO: Sometimes, it will not be destroyed.
        spawnedObj = obj;
    }
コード例 #6
0
ファイル: UIInput.cs プロジェクト: Smoothstep/VRChat
 protected virtual void Cleanup()
 {
     if ((bool)((UnityEngine.Object) this.mHighlight))
     {
         this.mHighlight.enabled = false;
     }
     if ((bool)((UnityEngine.Object) this.mCaret))
     {
         this.mCaret.enabled = false;
     }
     if (!(bool)((UnityEngine.Object) this.mBlankTex))
     {
         return;
     }
     NGUITools.Destroy((UnityEngine.Object) this.mBlankTex);
     this.mBlankTex = (Texture2D)null;
 }
コード例 #7
0
 void OnMailInfo(Notification data)
 {
     if (data != null)
     {
         SlgPB.Notify notify = data._data as SlgPB.Notify;
         foreach (KeyValuePair <int, MailItem> kvp in _mailItemDic)
         {
             if (notify.notifyId == kvp.Key)
             {
                 NGUITools.Destroy(kvp.Value.gameObject);
                 _Grid.Reposition();
                 _mailItemDic.Remove(kvp.Key);
                 return;
             }
         }
     }
 }
コード例 #8
0
    private void LoadBackground()
    {
        // Get the index of what the next stage should be
        int remainder;
        int stageIndex = Math.DivRem(this.Level, this.LevelSelectCreator.LevelsPerStage, out remainder);

        stageIndex -= remainder == 0 ? 1 : 0;

        // Get the background it should be
        GameObject newBackground = this.StageBackgroundMappings[stageIndex];

        // Set the background music
        SoundManager.Instance.PlayBackgroundMusic(this.MusicMappings[stageIndex], true);

        if (this.currentBackground == null)
        {
            // Set the anchors of the background
            UIWidget uiWidget = newBackground.GetComponent <UIWidget>();
            if (uiWidget != null)
            {
                uiWidget.SetAnchor(this.ParentPanel.gameObject, -10, -10, 10, 10);
            }

            // The background hasn't been set before, so create it
            this.currentBackground = NGUITools.AddChild(this.ParentGameBoard, newBackground);
        }
        else if (stageIndex != this.currentStageIndex)
        {
            // The stage has been set before, so remove the old one
            if (this.currentBackground != null)
            {
                NGUITools.Destroy(this.currentBackground);
            }

            // Set the anchors of the background
            UIWidget uiWidget = newBackground.GetComponent <UIWidget>();
            if (uiWidget != null)
            {
                uiWidget.SetAnchor(this.ParentPanel.gameObject, -10, -10, 10, 10);
            }

            this.currentBackground = NGUITools.AddChild(this.ParentGameBoard, newBackground);
        }

        this.currentStageIndex = stageIndex;
    }
コード例 #9
0
 public IEnumerator RefreshSlot()
 {
     for (int i = 0; i < _slots.Count; i++)
     {
         UIInventorySlot slot = _slots[i];
         slot.Refresh();
         if (slot.item.Count <= 0)
         {
             NGUITools.Destroy(slot.gameObject);
             _slots.Remove(slot);
             slotRoot.Reposition();
             scrollView.ResetPosition();
             i--;
         }
         yield return(null);
     }
 }
コード例 #10
0
    private void Step_Complete()
    {
        _step = Step.Complete;
        match.HideGuideTip();

        match.m_uiMatch.mCounter24.gameObject.SetActive(false);
        NGUITools.Destroy(_arrow_indicator);

        if (!_free_mode && !MainPlayer.Instance.IsPractiseCompleted(practise.ID))
        {
            StartCoroutine(base.Step_Complete(true));
        }
        else
        {
            StartCoroutine(ReturnToListLater());
        }
    }
コード例 #11
0
    /// <summary>
    /// Cleanup.
    /// </summary>

    protected override void Cleanup()
    {
        if (mHighlight)
        {
            mHighlight.enabled = false;
        }
        if (mCaret)
        {
            mCaret.enabled = false;
        }

        if (mBlankTex)
        {
            NGUITools.Destroy(mBlankTex);
            mBlankTex = null;
        }
    }
コード例 #12
0
    /// <summary>
    /// Drop the item onto the specified object.
    /// </summary>

    protected virtual void OnDragDropRelease(UnityEngine.GameObject surface)
    {
        UIManager.dragtime = UnityEngine.Time.realtimeSinceStartup;
        if (!cloneOnDrag)
        {
            NGUITools.Destroy(gameObject);

            if (onRealse != null)
            {
                onRealse(surface);
            }
        }
        else
        {
            NGUITools.Destroy(gameObject);
        }
    }
コード例 #13
0
ファイル: Order.cs プロジェクト: bback99/Dakgogi
    public void ClearScrollView()
    {
        // to initialize previous item lists
        List <GameObject> oldItems = new List <GameObject> ();

        foreach (UIDragScrollView ob in gameObject.GetComponentsInChildren <UIDragScrollView>())
        {
            ob.gameObject.transform.parent = null;
            oldItems.Add(ob.gameObject);
            ob.gameObject.SetActive(false);
        }

        foreach (GameObject go in oldItems)
        {
            NGUITools.Destroy(go);
        }
    }
コード例 #14
0
    void ClearWhisperItemList()
    {
        List <Transform> itemlist = new List <Transform>();

        foreach (Transform t in _whisperGrid.transform)
        {
            itemlist.Add(t);
        }

        foreach (Transform t in itemlist)
        {
            t.parent = null;
            NGUITools.Destroy(t.gameObject);
        }

        itemlist.Clear();
    }
コード例 #15
0
    void ReleaseDetailCard()
    {
        if (_isCloseAnimated)
        {
            return;
        }

        // updownmovement
        if (closeDetailCardThresholdHorizontal <= Mathf.Abs(_swipeScripts.CurrentDistance))
        {
            _isCloseAnimated = true;
            _detailCardScrollView.panel.clipping = UIDrawCall.Clipping.SoftClip;

            TweenScale tweenScale = _swipeScripts.gameObject.AddComponent <TweenScale>();

            if (null == tweenScale)
            {
                throw new MissingComponentException();
            }

            tweenScale.from = _swipeScripts.ScrollViewContainer.transform.localScale;

            tweenScale.to = Vector3.zero;

            tweenScale.duration = 0.5f;

            tweenScale.SetOnFinished(() =>
            {
                _isCloseAnimated = false;
                tweenScale.to    = Vector3.one;
                NGUITools.Destroy(_detailCard);
                _cardToPresent = null;
                NGUITools.SetActive(_mainCarousel.ScrollView.transform.gameObject, true);
                _detailCardScrollView.enabled = false;
                _detailCardScrollView.transform.localScale = Vector3.one;
            });

            tweenScale.enabled = true;
            tweenScale.PlayForward();

            if (null != _releaseToCloseSprite)
            {
                NGUITools.SetActive(_releaseToCloseSprite.transform.gameObject, false);
            }
        }
    }
コード例 #16
0
    private static int Destroy(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 1);
            UnityEngine.Object obj = ToLua.CheckUnityObject(L, 1, typeof(UnityEngine.Object));
            NGUITools.Destroy(obj);
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
コード例 #17
0
    public void AddQuizList(QuizInfo quizInfo)
    {
        mAccumulatedY = 0f;
//		mPosGuide = 0f;
        mPosGuide    = (122 - 30f) / 2f;
        mPreItemSize = 122f;

        QuizMgr.AddQuizList(quizInfo);
//		QuizInfo quizInfo = quizEvent.Response.data.quiz[quizEvent.Response.data.quiz.Count-1];
        if (quizInfo.gameRound == mGameRound &&
            quizInfo.inningType == mInningType)
        {
            GameObject go = mQuizListItems [0];
            RepositionItems(-go.GetComponent <BoxCollider2D> ().size.y);
            mQuizListItems.RemoveAt(0);
            NGUITools.Destroy(go);
        }
//		Debug.Log ("quizInfo.gameRound : " + quizInfo.gameRound + ", mGameRound : " + mGameRound);
//		Debug.Log ("quizInfo.inningType : " + quizInfo.inningType + ", mInningType : " + mInningType);

        AddQuizIntoList(quizInfo);

        mGameRound  = quizInfo.gameRound;
        mInningType = quizInfo.inningType;

        GameObject obj = Instantiate(itemRound, new Vector3(0f, 0f, 0f), Quaternion.identity) as GameObject;

        mQuizListItems.Insert(0, obj);
        RepositionItems(obj.GetComponent <BoxCollider2D> ().size.y);

        obj.transform.parent     = mList.transform;    //.FindChild("Grid");
        obj.transform.localScale = new Vector3(1f, 1f, 1f);
        if (mInningType == 0)
        {
            obj.transform.FindChild("LblTail").gameObject.SetActive(false);
        }
        else
        {
            obj.transform.FindChild("LblHead").gameObject.SetActive(false);
        }

        obj.transform.FindChild("LblRound").GetComponent <UILabel>().text = mGameRound + "";
        obj.transform.localPosition = new Vector3(0f, 0f, 0f);

        mList.GetComponent <UIScrollView> ().ResetPosition();
    }
コード例 #18
0
    void StepClear()
    {
        foreach (GameObject button in listenedFinishButton)
        {
            UIEventListener.Get(button).onClick -= OnFinishStepClick;
            if (button.GetComponent <UIScrollView>() != null)
            {
                button.GetComponent <UIScrollView>().enabled = true;
            }
        }
        listenedFinishButton.Clear();
        timerFinishStep.stop = true;

        ResumeButtonState();

        foreach (GameObject effect in effects)
        {
            NGUITools.Destroy(effect);
        }
        effects.Clear();

        foreach (GameObject mask in masks)
        {
            if (mask != null)
            {
                NGUITools.Destroy(mask);
            }
        }
        masks.Clear();
        if (tip != null)
        {
            NGUITools.Destroy(tip);
            Debug.Log("Clear tip, " + (curStep != null ? curStep.ID.ToString() : "NULL"));
            tip = null;
        }
        if (panelInstructor != null)
        {
            NGUITools.Destroy(panelInstructor.gameObject);
            panelInstructor = null;
        }

        showTipAfterAnimating = false;
        guideHiding           = false;
        shutter = null;
    }
コード例 #19
0
    private void SetItem(GameObjList items)
    {
        if (items.Count <= 0)
        {
            btnTakeAll.gameObject.SetActive(false);
        }
        else
        {
            btnTakeAll.gameObject.SetActive(true);
        }

        foreach (GameObject go in _gifts)
        {
            NGUITools.Destroy(go);
        }
        _gifts.Clear();


        foreach (GameObj obj in items)
        {
            UserItem userItem = (UserItem)obj;
            userItem.GameItem = (GameItem)GameManager.GameItems[userItem.ItemId];

            GameObject go = NGUITools.AddChild(giftRoot.gameObject, giftRefab);
            go.SetActive(true);

            UITexture icon  = go.transform.FindChild("Texture").GetComponent <UITexture>();
            UILabel   label = go.transform.FindChild("Label").GetComponent <UILabel>();

            if (userItem.GameItem.SubKind == (int)ItemSubKind.Equipment)
            {
                icon.mainTexture = Helper.LoadTextureForEquipItem(userItem.ItemId);
            }
            else
            {
                icon.mainTexture = Helper.LoadTextureForSupportItem(userItem.ItemId);
            }

            label.text = "x" + userItem.Count;
            _gifts.Add(go);
        }

        giftRoot.Reposition();
        giftRoot.transform.parent.GetComponent <UIScrollView>().ResetPosition();
    }
コード例 #20
0
    public void OnResponseAddFriend()
    {
        string tab;

        if (_friendActiveType == FriendActiveType.AddFriend)
        {
            tab = GameManager.localization.GetText("Social_Tab_Friend");
            string s = string.Format(GameManager.localization.GetText("Social_FindUser_AddSuccess"), _curNicknameAdd, tab);
            MessageBox.ShowDialog(s, UINoticeManager.NoticeType.Message);
        }
        else if (_friendActiveType == FriendActiveType.AddEnemy)
        {
            tab = GameManager.localization.GetText("Social_Tab_Enemy");
            string s = string.Format(GameManager.localization.GetText("Social_FindUser_AddSuccess"), _curNicknameAdd, tab);
            MessageBox.ShowDialog(s, UINoticeManager.NoticeType.Message);
        }
        else if (_friendActiveType == FriendActiveType.RemoveEnemy)
        {
            tab = GameManager.localization.GetText("Social_Tab_Enemy");
            string s = string.Format(GameManager.localization.GetText("Social_Dialog_DeleteSuccess"), _curNicknameAdd, tab);
            MessageBox.ShowDialog(s, UINoticeManager.NoticeType.Message);
        }
        else if (_friendActiveType == FriendActiveType.RemoveFriend)
        {
            tab = GameManager.localization.GetText("Social_Tab_Friend");
            string s = string.Format(GameManager.localization.GetText("Social_Dialog_DeleteSuccess"), _curNicknameAdd, tab);
            MessageBox.ShowDialog(s, UINoticeManager.NoticeType.Message);
        }


        foreach (GameObject go in uiEnemy.list)
        {
            NGUITools.Destroy(go);
        }
        uiEnemy.list.Clear();

        foreach (GameObject go in uiFriend.list)
        {
            NGUITools.Destroy(go);
        }
        uiFriend.list.Clear();

        StartCoroutine(InitFiendList(true));
        StartCoroutine(InitFiendList());
    }
コード例 #21
0
    /// <summary>
    /// 更新自己的任务
    /// 这里应该是只显示自己领取的任务
    /// </summary>
    /// <param name="taskType"></param>
    void UpdateTasks(List <MissionTaskSystem> tasks, TaskProgress progress)
    {
        // List<MissionTaskSystem> list = TaskManager._instance.getTasksByProgress(progress);
        List <MissionTaskSystem> list = tasks;

        if (list.Count < 0)
        {
            return;
        }
        GameObject go = null;

        if (TaskLine == null)
        {
            Debug.LogError("TaskLine预置为空!");
        }
        List <Transform> children = tasksList.GetChildList();

        if (children != null)
        {
            //首先全部清空一次
            for (int i = 0; i < children.Count; i++)
            {
                NGUITools.Destroy(children[i].gameObject);
                tasksList.RemoveChild(children[i]);
            }
        }
        int length = 0;

        foreach (MissionTaskSystem task in list)
        {
            //装备上的以及用完的药品是不能显示的
            if (task.TaskProgress == progress)
            {
                go = NGUITools.AddChild(tasksList.gameObject, TaskLine);
                go.GetComponent <TaskLine>().SetTask(task);
                length++;
            }
        }
        //告诉表格排序
        if (go != null)
        {
            tasksList.AddChild(go.transform);
        }
        tasksList.enabled = true;
    }
コード例 #22
0
    void OnFighterChanged(FighterInfo fighter)
    {
        //Get rid of our old list
        foreach (GameObject child in children)
        {
            NGUITools.Destroy(child);
        }
        children.Clear(); //Empty the list for future use

        //Create all the new
        foreach (FileInfo imageFile in fighter.sprite_info.spriteFiles)
        {
            instantiateButton(imageFile);
        }

        //Realign the grid
        grid.Reposition();
    }
コード例 #23
0
 public void IsBuff(bool buff)
 {
     if (buff)
     {
         GameObject obj = NGUITools.AddChild(grid.gameObject, (GameObject)ResMgr.Instance.LoadAssetFromResource("Prefabs/UI/Overlay/status"));
         obj.name = "buff";
         obj.GetComponent <UISprite>().spriteName = "tray_buff";
         StartCoroutine(RefreshGrid());
     }
     else
     {
         Transform target = grid.transform.Find("buff");
         if (target != null)
         {
             NGUITools.Destroy(target.gameObject);
         }
     }
 }
コード例 #24
0
        private void CleanUpPreviousCards()
        {
            // Clean up previous cards
            List <GameObject> currentCardsList = new List <GameObject>();

            foreach (Transform child in previousLocationView.transform)
            {
                currentCardsList.Add(child.gameObject);
            }

            if (currentCardsList.Count > 0)
            {
                foreach (GameObject child in currentCardsList)
                {
                    NGUITools.Destroy(child);
                }
            }
        }
コード例 #25
0
ファイル: UIManager.cs プロジェクト: atom-chen/shisanshui-1
    //销毁UI
    public void Destroy(WinID ID)
    {
        UIWin win = UIInstances[(int)ID];

        if (!win)
        {
            return;
        }
        if (IsOpen(ID))
        {
            win.closeAnim = null; //needn't play animation. destory it now!
            CloseWindow(win);
        }
        NGUITools.Destroy(win.gameObject);
        UIInstances[(int)ID] = null;
        Resources.UnloadUnusedAssets();
        GC.Collect();
    }
コード例 #26
0
    void OnSpriteInfoChanged(SpriteInfo sprite_info)
    {
        //Get rid of our old list
        foreach (GameObject child in children)
        {
            NGUITools.Destroy(child);
        }
        children.Clear(); //Empty the list for future use

        //Create all the new buttons
        foreach (AnimationDefinition anim in sprite_info.animations)
        {
            instantiateButton(anim);
        }

        //Realign the grid
        grid.Reposition();
    }
コード例 #27
0
 internal void Release()
 {
     if (mSprite_ParamType != null)
     {
         mSprite_ParamType.RemoveFromPanel();
         mSprite_ParamType.Clear();
         NGUITools.Destroy(mSprite_ParamType);
     }
     mSprite_ParamType = null;
     NGUITools.Destroy(mLabel_Value);
     mLabel_Value = null;
     if (mSprite_Status != null)
     {
         mSprite_Status.Clear();
         NGUITools.Destroy(mSprite_Status);
     }
     mSprite_Status = null;
 }
コード例 #28
0
 private IEnumerator Step_SwitchRole()
 {
     _step = Step.SwitchRole;
     match.HideGuideTip();
     match.HideTipArrow();
     match.m_uiMatch.ShowMsg(UIMatch.MSGType.eFoul_24, false);
     NGUITools.Destroy(_arrow_indicator);
     _arrow_indicator = null;
     match.m_ruler.SwitchRole();
     match.m_gameMatchCountStop = false;
     match.ResetPlayerPos();
     if (match.mCurScene.mBall.m_owner != null)
     {
         match.mCurScene.mBall.m_owner.DropBall(match.mCurScene.mBall);
     }
     npc2.GrabBall(match.mCurScene.mBall);
     yield return(new WaitForSeconds(WAIT_SECONDS));
 }
コード例 #29
0
    public static void ClearTableChild(Transform trans)
    {
        if (trans == null)
        {
            return;
        }

        UITable table = trans.GetComponent <UITable>();

        if (table)
        {
            for (int i = 0; i < table.children.Count; ++i)
            {
                NGUITools.Destroy(table.children[i].gameObject);
            }
            table.children.Clear();
        }
    }
コード例 #30
0
    private void DoBallEffect(Transform trans)
    {
        var child = trans.FindChild("UI_TuJianHeCheng(Clone)");

        NGUITools.Destroy(child);

        ResourceManager.PrepareResource <GameObject>("Effect/UI/UI_TuJianHeCheng.prefab", res =>
        {
            var go        = NGUITools.AddChild(trans.gameObject, res);
            var particle  = go.GetComponent <ParticleScaler>();
            particle.IsUi = true;
            StartCoroutine(DestroyEffect(1f, () =>
            {
                var effect = trans.FindChild("UI_TuJianHeCheng(Clone)");
                NGUITools.Destroy(effect);
            }));
        }, true, true, true, true, true);
    }