void OnClick()
    {
        GameObject tab = GameObject.FindGameObjectWithTag("TabOpened");

        centerOnChildComp = tab.GetComponent <UICenterOnChild>();
        table             = tab.GetComponent <UITable>();

        if (next)
        {
            int index = table.GetChildList().IndexOf(centerOnChildComp.centeredObject.transform) + 1;
            if (index < table.GetChildList().Count)
            {
                centerOnChildComp.CenterOn(table.GetChildList()[index]);
            }
        }
        else
        {
            int index = table.GetChildList().IndexOf(centerOnChildComp.centeredObject.transform) - 1;
            if (index > -1)
            {
                centerOnChildComp.CenterOn(table.GetChildList()[index]);
            }
        }

        //sv.customMovement = v;
    }
Esempio n. 2
0
 public void InitViews(SlotitemModel dstSlotItem)
 {
     if (dstSlotItem == null)
     {
         SwitchActive(active: false);
         weaponName.text = "\u3000-";
         mLock_Icon.transform.localScale = Vector3.zero;
         return;
     }
     SwitchActive(active: true);
     weaponName.text           = dstSlotItem.Name;
     weaponTypeIcon.spriteName = $"icon_slot{dstSlotItem.Type4}";
     UnloadSlotItemTexture();
     weaponImage.mainTexture = BgTextureResourceLoad(dstSlotItem.MstId);
     if (dstSlotItem.IsLocked())
     {
         mLock_Icon.transform.localScale = Vector3.one;
     }
     else
     {
         mLock_Icon.transform.localScale = Vector3.zero;
     }
     paramTable.GetChildList().ForEach(delegate(Transform e)
     {
         NGUITools.Destroy(e);
     });
 }
Esempio n. 3
0
    static int GetChildList(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        UITable          obj = (UITable)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UITable");
        List <Transform> o   = obj.GetChildList();

        LuaScriptMgr.PushObject(L, o);
        return(1);
    }
Esempio n. 4
0
        private void ResetItem()
        {
            List <Transform> itemList = previewTable.GetChildList();

            for (int i = 0; i < itemList.Count; i++)
            {
                itemList[i].gameObject.SetActive(false);
                itemList[i].gameObject.SetActive(true);
            }
        }
Esempio n. 5
0
    void displayScores()
    {
        scoreTable.gameObject.SetActive(true);
        scoreTableHeader.gameObject.SetActive(true);

        loadScores();
        scoreTable.GetChildList().Clear();
        scoreTable.columns = 2;

        for (int i = 0; i < scoreTable.gameObject.transform.childCount; i++)
        {
            Destroy(scoreTable.gameObject.transform.GetChild(i).gameObject);
        }

        Debug.Log("score count" + scores.Count);
        var scoresOrdered = scores.OrderByDescending(s => s.Score).Take(10).ToList();

        Debug.Log("scores ordered count " + scoresOrdered.Count());

        if (scoresOrdered.Count == 0)
        {
            scoresOrdered.Add(new Scores()
            {
                Name = "None"
            });
        }

        var font = scoreLabel.bitmapFont;

        foreach (var s in scoresOrdered)
        {
            Debug.Log("score " + s.Name + " " + s.Score);

            var nameLabel  = NGUITools.AddWidget <UILabel>(scoreTable.gameObject);
            var valueLabel = NGUITools.AddWidget <UILabel>(scoreTable.gameObject);

            nameLabel.bitmapFont = font;
            nameLabel.fontSize   = fontSize;
            nameLabel.width      = 100;
            nameLabel.height     = 50;
            nameLabel.text       = s.Name;

            valueLabel.bitmapFont = font;
            valueLabel.fontSize   = fontSize;
            valueLabel.width      = 100;
            valueLabel.height     = 50;
            if (s.Score > 0)
            {
                valueLabel.text = s.Score + string.Empty;
            }
        }

        scoreTable.Reposition();
    }
Esempio n. 6
0
        public void Clear(int quantity)
        {
            if (quantity == 0)
            {
                return;
            }

            quantity = Mathf.Min(TextTable.transform.childCount, quantity);

            for (int i = TextTable.GetChildList().Count - 1; i >= 0 && quantity > 0; i--)
            {
                quantity--;

                if (TextTable.GetChildList()[i])
                {
                    Destroy(TextTable.transform.GetChild(i).gameObject);
                }
            }

            TextTable.Reposition();
        }
Esempio n. 7
0
    private void Awake()
    {
        m_oper = GetComponent <OperatorBase>();

        m_inputOperators    = new OperatorLink[m_oper.inputCount];
        m_outputOperators   = new List <OperatorLink>();
        m_outputOperatorIdx = new List <int>();

        UITable          inputUITable = transform.Find("Input/Table").GetComponent <UITable>();
        List <Transform> children     = inputUITable.GetChildList();

        for (int i = children.Count; i < m_oper.inputCount; ++i)
        {
            GameObject child = NGUITools.AddChild(inputUITable.gameObject, m_inputUISample);
            child.SetActive(true);
        }

        children = inputUITable.GetChildList();
        for (int i = 0; i != children.Count; ++i)
        {
            if (i < m_oper.inputCount)
            {
                children[i].gameObject.SetActive(true);
                children[i].gameObject.name = i.ToString();
                UIEventListener.Get(children[i].gameObject).onClick = OnClickInputChild;
            }
            else
            {
                children[i].gameObject.SetActive(false);
            }
        }
        inputUITable.Reposition();

        Transform outputNode = transform.Find("Output");

        if (outputNode != null)
        {
            UIEventListener.Get(outputNode.gameObject).onClick = OnClickOutput;
        }
    }
Esempio n. 8
0
 static public int GetChildList(IntPtr l)
 {
     try {
         UITable self = (UITable)checkSelf(l);
         var     ret  = self.GetChildList();
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Esempio n. 9
0
    void Start()
    {
        btnExits.GetComponent <UISprite>().SetAnchor(NGUITools.GetRoot(gameObject).transform);
        btnExits.GetComponent <UISprite>().topAnchor.absolute    = 0;
        btnExits.GetComponent <UISprite>().leftAnchor.absolute   = 0;
        btnExits.GetComponent <UISprite>().rightAnchor.absolute  = 0;
        btnExits.GetComponent <UISprite>().bottomAnchor.absolute = 0;
        LobbyScene lobby = GameObject.Find("Lobby Scene").GetComponent <LobbyScene>();

        valuesBetting = lobby.presenter.SelectedChannel.configuration.betting;
        for (int i = 0; i < valuesBetting.Length; i++)
        {
            double             currentBetting = valuesBetting[i];
            string             value          = Utility.Convert.ConvertShortcutMoney(currentBetting / 2) + "/" + Utility.Convert.ConvertShortcutMoney(currentBetting);
            SearchViewCheckbox item           = SearchViewCheckbox.Create(value, i);
            item.name                    = "" + i;
            item.transform.parent        = tableBetValue.transform;
            item.transform.localScale    = Vector3.one;
            item.transform.localPosition = Vector3.zero;
            if (lobby.isFiltered())
            {
                item.GetComponent <UIToggle>().value = false;
            }
        }
        tableBetValue.Reposition();
        if (lobby.isFiltered())
        {
            txtInput.value = lobby.TxtSearch();
            if (lobby.options() != null)
            {
                foreach (int key in lobby.options().Keys)
                {
                    if (key == TYPE_5_PEOPLE)
                    {
                        cbFivePeople.value = lobby.options()[key];
                    }
                    if (key == TYPE_9_PEOPLE)
                    {
                        cbNinePeople.value = lobby.options()[key];
                    }
                }
            }

            foreach (double value in lobby.presenter.betValueSearch)
            {
                int index = Array.FindIndex <double>(valuesBetting, a => a == value);
                tableBetValue.GetChildList()[index].GetComponent <UIToggle>().value = true;
            }
        }
    }
Esempio n. 10
0
 static int GetChildList(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UITable obj = (UITable)ToLua.CheckObject <UITable>(L, 1);
         System.Collections.Generic.List <UnityEngine.Transform> o = obj.GetChildList();
         ToLua.PushSealed(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Esempio n. 11
0
        protected virtual void HideTableItems()
        {
            var list = Table.GetChildList();

            foreach (var item in list)
            {
                HideItem(item);
                var view = item.GetComponent <YxView>();
                if (view)
                {
                    view.Hide();
                }
                else
                {
                    item.gameObject.SetActive(false);
                }
            }
        }
Esempio n. 12
0
    private static int GetChildList(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 1);
            UITable          uITable   = (UITable)ToLua.CheckObject(L, 1, typeof(UITable));
            List <Transform> childList = uITable.GetChildList();
            ToLua.PushObject(L, childList);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
Esempio n. 13
0
    private void RepositionTable()
    {
        //IL_0036: Unknown result type (might be due to invalid IL or missing references)
        //IL_003b: Unknown result type (might be due to invalid IL or missing references)
        //IL_004f: Unknown result type (might be due to invalid IL or missing references)
        UITable component = base.GetComponent <UITable>((Enum)UI.TBL_QUEST);

        if (!(component == null))
        {
            component.Reposition();
            List <Transform> childList = component.GetChildList();
            for (int i = 0; i < childList.Count; i++)
            {
                Vector3 localPosition = childList[i].get_localPosition();
                localPosition.x = 0f;
                childList[i].set_localPosition(localPosition);
            }
        }
    }
    protected void RepositionTable()
    {
        //IL_003a: Unknown result type (might be due to invalid IL or missing references)
        //IL_003f: Unknown result type (might be due to invalid IL or missing references)
        //IL_0054: Unknown result type (might be due to invalid IL or missing references)
        UITable component = base.GetComponent <UITable>((Enum)UI.TBL_DELIVERY_QUEST);

        if (Object.op_Implicit(component))
        {
            component.Reposition();
            List <Transform> childList = component.GetChildList();
            int i = 0;
            for (int count = childList.Count; i < count; i++)
            {
                Vector3 localPosition = childList[i].get_localPosition();
                localPosition.x = 0f;
                childList[i].set_localPosition(localPosition);
            }
        }
    }
Esempio n. 15
0
    //tolua
    public void InitBag(List <ItemViewData> list, TabType type)
    {
        while (grid.transform.childCount > 0)
        {
            DestroyImmediate(grid.transform.GetChild(0).gameObject);
        }
        viewList = new Hashtable();
        for (int index = 0; index < MAXBLOCK; index++)
        {
            //设置格子
            GameObject obj = Instantiate(itemPrefab);
            obj.SetActive(true);
            ItemView     pop  = obj.GetComponent <ItemView>();
            ItemViewData data = null;
            if (index < list.Count)
            {
                data = list[index];
                if (data != null)
                {
                    //如果指定类型就给添加到table
                    if ((type == TabType.All || type == (TabType)data.data.bagType) && data.data.isShow == 0)
                    {
                        obj.name = data.sort;
                        if (data.curCount < 1)
                        {
                            data = null;
                        }
                    }
                    else
                    {
                        data = null;
                    }
                    if (data == null)
                    {
                        obj.name = "None";
                    }
                }
            }
            else
            {
                obj.name = "None";
            }
            pop.InitData(data, index);
            if (data != null)
            {
                data.view = pop;
            }
            pop.transform.parent     = grid.transform;
            pop.transform.localScale = Vector3.one;
            viewList.Add(index, pop);
        }

        grid.Reposition();
        scroll.ResetPosition();
        grid.repositionNow = true;
        if (list != null && list.Count > 0)
        {
            BagMgr.Instance.SelectItem(grid.GetChildList()[0].gameObject.GetComponent <ItemView>());
        }
        //MoveToLastVertical();
    }
Esempio n. 16
0
    void displayAchievements()
    {
        achievementsTable.gameObject.SetActive(true);
        achievementsTableHeader.gameObject.SetActive(true);

        loadAchievements();

        achievementsTable.columns = 4;
        achievementsTable.GetChildList().Clear();
        for (int i = 0; i < achievementsTable.gameObject.transform.childCount; i++)
        {
            Destroy(achievementsTable.gameObject.transform.GetChild(i).gameObject);
        }

        var font = scoreLabel.bitmapFont;

        foreach (var achievementItem in achievements.AsEnumerable())
        {
            var nameLabel        = NGUITools.AddWidget <UILabel>(achievementsTable.gameObject);
            var descriptionLabel = NGUITools.AddWidget <UILabel>(achievementsTable.gameObject);
            var unlockedLabel    = NGUITools.AddWidget <UILabel>(achievementsTable.gameObject);
            var achievement      = achievementItem.FirstOrDefault();

            if (!(achievement.IsRevealed || achievement.IsUnlocked))
            {
                continue;
            }

            var saved = savedAchievements.FirstOrDefault(a => string.Compare(a.Id, achievement.Id, StringComparison.OrdinalIgnoreCase) == 0);

            var rewardSprite = NGUITools.AddWidget <UISprite>(achievementsTable.gameObject);
            if (achievement.IsUnlocked)
            {
                rewardSprite.color = saved.RewardEnabled ? buttonPrefab.disabledColor : buttonPrefab.defaultColor;
            }
            else
            {
                rewardSprite.enabled = false;
            }

            rewardSprite.width      = 50;
            rewardSprite.height     = 50;
            rewardSprite.name       = "Label";
            rewardSprite.atlas      = spritePrefab.atlas;
            rewardSprite.spriteName = spritePrefab.spriteName;

            rewardSprite.gameObject.AddComponent <BoxCollider>();
            rewardSprite.autoResizeBoxCollider = true;
            rewardSprite.ResizeCollider();

            UIEventListener.Get(rewardSprite.gameObject).onClick += go =>
            {
                Debug.Log("on click " + saved.RewardEnabled);
                saved.RewardEnabled = !saved.RewardEnabled;
                rewardSprite.color  = saved.RewardEnabled ? buttonPrefab.disabledColor : buttonPrefab.defaultColor;
                saveAchievements();
            };


            nameLabel.bitmapFont = font;
            nameLabel.fontSize   = fontSize;
            nameLabel.width      = 200;
            nameLabel.height     = 50;
            nameLabel.text       = achievement.Name;

            descriptionLabel.bitmapFont = font;
            descriptionLabel.fontSize   = fontSize;
            descriptionLabel.width      = 400;
            descriptionLabel.height     = 100;
            descriptionLabel.text       = achievement.Description;

            unlockedLabel.bitmapFont = font;
            unlockedLabel.fontSize   = fontSize;
            unlockedLabel.width      = 100;
            unlockedLabel.height     = 50;
            unlockedLabel.text       = achievement.IsUnlocked ? "Unlocked" : "Locked";
        }

        achievementsTable.Reposition();
    }
Esempio n. 17
0
    public void assignValue()
    {
        tabla = gameObject.GetComponent <UITable> ();
        List <Transform> lista = tabla.GetChildList();

        foreach (Transform t in lista)
        {
            GameObject         go = t.gameObject;
            VariableController vc = go.GetComponent <VariableController> ();

            //Debug.Log (vc.getValueString());
            //string vcString = vc.getValueString();

            // Get the name of the object and asign the value to it
            if (vc.getValueString() == "Machine")
            {
                Debug.Log("Machine");
                string value = Session_App.activeMachine.MachineID;
                Debug.Log(value);
                vc.setValueToLabel(value);
            }
            else if (vc.getValueString() == "RegisterDate")
            {
                Debug.Log("RegisterDate");
                string value = Session_App.activeMachine.RegisterDate;
                Debug.Log(value);
                vc.setValueToLabel(value);
            }
            else if (vc.getValueString() == "Xp")
            {
                Debug.Log("Xp");
                string value = Session_App.activeMachine.Xp;
                Debug.Log(value);
                vc.setValueToLabel(value);
            }
            else if (vc.getValueString() == "Yp")
            {
                Debug.Log("Yp");
                string value = Session_App.activeMachine.Yp;
                Debug.Log(value);
                vc.setValueToLabel(value);
            }
            else if (vc.getValueString() == "Zp")
            {
                Debug.Log("Zp");
                string value = Session_App.activeMachine.Zp;
                Debug.Log(value);
                vc.setValueToLabel(value);
            }
            else if (vc.getValueString() == "Xload")
            {
                Debug.Log("Zp");
                string value = Session_App.activeMachine.Zp;
                Debug.Log(value);
                vc.setValueToLabel(value);
            }
            else if (vc.getValueString() == "Yload")
            {
                Debug.Log("Yload");
                string value = Session_App.activeMachine.Yload;
                Debug.Log(value);
                vc.setValueToLabel(value);
            }
            else if (vc.getValueString() == "Zload")
            {
                Debug.Log("Zload");
                string value = Session_App.activeMachine.Zload;
                Debug.Log(value);
                vc.setValueToLabel(value);
            }


            //bool checkVar = Session_App.values.ContainsKey (vcString);

            //Debug.Log (checkVar);
            //if(Session_App.activeMachine){
            //string valueChecked = Session_App.values [vcString];
            //Debug.Log (valueChecked);
            //vc.setValueToLabel (valueChecked);
            //}
        }
    }