Exemple #1
0
 public void init()
 {
     if (popMenuItem.Count != 0)
     {
         popMenuItem.Clear();
         foreach (Transform item in grid.transform)
         {
             Destroy(item.gameObject);
         }
     }
     flow = flows.getflows();
     for (int i = 0; i < flow.Count; i++)
     {
         GameObject obj = ResourceManager.getInstance().loadUISpawnPool(popItem, null);
         grid.AddChild(obj.transform);
         obj.transform.position   = Vector3.zero;
         obj.transform.localScale = new Vector3(1, 1, 1);
         obj.name = flow[i].index.ToString();
         obj.transform.Find("name").GetComponent <UILabel>().text = flow[i].name.text;
         UIEventListener.Get(obj).onClick = popItemClick;
         popMenuItem.Add(obj.GetComponent <UISprite>());
     }
     grid.repositionNow = true;
     grid.Reposition();
     scrollBar.value = 0;
 }
Exemple #2
0
    static int AddChild(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UIGrid), typeof(UnityEngine.Transform)))
            {
                UIGrid obj = (UIGrid)ToLua.ToObject(L, 1);
                UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.ToObject(L, 2);
                obj.AddChild(arg0);
                return(0);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(UIGrid), typeof(UnityEngine.Transform), typeof(bool)))
            {
                UIGrid obj = (UIGrid)ToLua.ToObject(L, 1);
                UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.ToObject(L, 2);
                bool arg1 = LuaDLL.lua_toboolean(L, 3);
                obj.AddChild(arg0, arg1);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UIGrid.AddChild"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Exemple #3
0
    static int AddChild(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2)
            {
                UIGrid obj = (UIGrid)ToLua.CheckObject <UIGrid>(L, 1);
                UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.CheckObject <UnityEngine.Transform>(L, 2);
                obj.AddChild(arg0);
                return(0);
            }
            else if (count == 3)
            {
                UIGrid obj = (UIGrid)ToLua.CheckObject <UIGrid>(L, 1);
                UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.CheckObject <UnityEngine.Transform>(L, 2);
                bool arg1 = LuaDLL.luaL_checkboolean(L, 3);
                obj.AddChild(arg0, arg1);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UIGrid.AddChild"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Exemple #4
0
    /// <summary>
    /// 加载真实物理摄像机列表
    /// </summary>
    IEnumerator LoadMonitorInfo()
    {
        Logger.Instance.WriteLog("加载真实物理摄像机列表");
        List <CAMARE_INFO> infos;

        while (true)
        {
            infos = GetCameraInfo();
            if (infos != null)
            {
                for (int i = 0; i < infos.Count; i++)
                {
                    GameObject monitor = Instantiate(PhyDeviceListItemPrefab) as GameObject;
                    monitor.GetComponent <PhysicalDeviceListItem>().SetValue(i, infos[i], bind);
                    PhyDevItemContainer.AddChild(monitor.transform);
                    monitor.transform.localScale = new Vector3(1, 1, 1);
                }
//				foreach(CAMARE_INFO info in infos)
//				{
//					GameObject monitor = Instantiate(PhyDeviceListItemPrefab) as GameObject;
//					monitor.GetComponent<PhysicalDeviceListItem>().SetValue(info,bind);
//					PhyDevItemContainer.AddChild(monitor.transform);
//					monitor.transform.localScale = new Vector3(1,1,1);
//				}
                break;
            }
            yield return(new WaitForSeconds(1));
        }
        yield return(null);
    }
    static int AddChild(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 2)
        {
            UIGrid    obj  = (UIGrid)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UIGrid");
            Transform arg0 = (Transform)LuaScriptMgr.GetUnityObject(L, 2, typeof(Transform));
            obj.AddChild(arg0);
            return(0);
        }
        else if (count == 3)
        {
            UIGrid    obj  = (UIGrid)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UIGrid");
            Transform arg0 = (Transform)LuaScriptMgr.GetUnityObject(L, 2, typeof(Transform));
            int       arg1 = (int)LuaScriptMgr.GetNumber(L, 3);
            obj.AddChild(arg0, arg1);
            return(0);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: UIGrid.AddChild");
        }

        return(0);
    }
Exemple #6
0
    public void UpdateItems()
    {
        List <SlgPB.Task> tasks = InstancePlayer.instance.model_User.model_task.activeTasks;
        int tasksCount          = tasks.Count;

        grid.DestoryAllChildren();

        for (int i = 0; i < tasksCount; ++i)
        {
            GameObject prefab = Resources.Load(TASK_ITEM_PATH) as GameObject;
            GameObject obj    = NGUITools.AddChild(grid.gameObject, prefab);
            grid.AddChild(obj.transform);

            obj.name = UIHelper.GetItemSuffix(i);

            UITaskItem taskItem = obj.GetComponent <UITaskItem> ();
            taskItem.Init(tasks[i], this);
        }

        grid.animateSmoothly = false;
        grid.repositionNow   = true;

        if (tasksCount <= SHOW_MAX_COUNT)
        {
            scrollview.enabled = false;
        }
    }
Exemple #7
0
    static int AddChild(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 2)
        {
            UIGrid    obj  = LuaScriptMgr.GetNetObject <UIGrid>(L, 1);
            Transform arg0 = LuaScriptMgr.GetNetObject <Transform>(L, 2);
            obj.AddChild(arg0);
            return(0);
        }
        else if (count == 3)
        {
            UIGrid    obj  = LuaScriptMgr.GetNetObject <UIGrid>(L, 1);
            Transform arg0 = LuaScriptMgr.GetNetObject <Transform>(L, 2);
            bool      arg1 = LuaScriptMgr.GetBoolean(L, 3);
            obj.AddChild(arg0, arg1);
            return(0);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: UIGrid.AddChild");
        }

        return(0);
    }
Exemple #8
0
    public void UpdateRankContent()
    {
        if (WindObj == null || !WindObj.activeSelf)
        {
            return;
        }

        if (PlayerRole.Instance.RankManager.GetRankInfo() == null || PlayerRole.Instance.RelationManager.GetFriendMap() == null)
        {
            return;
        }
        m_RankList.Clear();
        ClearGird();
        if (PlayerRole.Instance.RankManager.GetRankInfo().ContainsKey((byte)m_RankType) == false)
        {
            return;
        }
        m_ScrollTrans.localPosition = new Vector3(64, 104, 0);
        m_UIPanel.clipOffset        = new Vector2(55.27f, -150);
        m_UIScrollView.ResetPosition();
        foreach (KeyValuePair <uint, tagRankInfo> map in PlayerRole.Instance.RankManager.GetRankInfo()[(byte)m_RankType].RankMap)
        {
            RankItemUI rank = new RankItemUI(m_RankType, map.Value);
            rank.Init(m_BaseChild);
            m_RankList.Add(rank);
        }
        m_RankList.Sort(CompareItemByIndex);
        for (byte i = 0; i < m_RankList.Count; ++i)
        {
            m_Grid.AddChild(m_RankList[i].m_BaseTrans, false);
            m_RankList[i].ResetScale();
        }
    }
Exemple #9
0
    void Start()
    {
        GameObject grid = transform.Find("Scroll View/Grid").gameObject;

        playerStatus = GameObject.FindGameObjectWithTag(Tags.player).GetComponent <PlayerStatus>();
        switch (playerStatus.heroType)
        {
        case HeroType.Magician:
            ids = SkillsInfo._instance.GetSkillInfoBy(ApplicableRole.Magician);
            break;

        case HeroType.Swordman:
            ids = SkillsInfo._instance.GetSkillInfoBy(ApplicableRole.Swordman);
            break;
        }
        UIGrid uigrid = grid.GetComponent <UIGrid>();

        foreach (int id in ids)
        {
            GameObject go = NGUITools.AddChild(grid, skillItemPrefab);
            uigrid.AddChild(go.transform);
            SkillItem item = go.GetComponent <SkillItem>();
            item.SetId(id);
        }
    }
Exemple #10
0
 private void InitContentView2()
 {
     for (int i = 0; i < DSkillTalent.TALENT_LEVELS.Length; i++)
     {
         GameObject item = NGUITools.AddChild(mContentGrid2.gameObject, mContentTemp2, i == 0);
         mContentGrid2.AddChild(item.transform);
         item.SetActive(true);
         ItemTalent tab = new ItemTalent();
         tab.talentLevel      = item.transform.Find("Level/Num").GetComponent <UILabel>();
         tab.talentLevelBack  = item.transform.Find("Level").GetComponent <UISprite>();
         tab.talentBacks      = new UISprite[3];
         tab.talentHighLights = new GameObject[3];
         tab.talentNames      = new UILabel[3];
         tab.talentBtns       = new GameObject[3];
         tab.talentIcons      = new UITexture[3];
         for (int k = 1; k <= 3; k++)
         {
             Transform trans = item.transform.Find(k.ToString());
             tab.talentBtns[k - 1]       = trans.gameObject;
             tab.talentBacks[k - 1]      = trans.Find("Back").GetComponent <UISprite>();
             tab.talentHighLights[k - 1] = trans.Find("HighLight").gameObject;
             tab.talentNames[k - 1]      = trans.Find("Name").GetComponent <UILabel>();
             tab.talentIcons[k - 1]      = trans.Find("Icon").GetComponent <UITexture>();
         }
         mTalents.Add(tab);
     }
 }
    public void addPoint(AiPoint point)
    {
        GameObject item = (GameObject)GameObject.Instantiate(mPointItem);

        item.SetActive(true);
        item.name             = "point" + point.id.ToString();
        item.transform.parent = mGrid.transform;
        mGrid.AddChild(item.transform);
        item.transform.localScale = new Vector3(1, 1, 1);
        item.transform.FindChild("UILabel_AIId").GetComponent <UILabel>().text       = point.id.ToString();
        item.transform.FindChild("UILabel_SpeedScale").GetComponent <UILabel>().text = point.speedScale.ToString();
        item.transform.FindChild("UILabel_Rchange").GetComponent <UILabel>().text    = point.rChange.ToString();
        item.transform.FindChild("UILabel_During").GetComponent <UILabel>().text     = point.time.ToString();
        item.GetComponent <UIButtonMessage>().functionName = "onClickPointItem";


        GameObject highlight = item.transform.FindChild("HighLight").gameObject;

        highlight.SetActive(true);
        highlight.GetComponent <UISprite>().enabled = true;
        if (prePointItem)
        {
            prePointItem.transform.FindChild("HighLight").gameObject.SetActive(false);
        }
        mGrid.repositionNow = true;
        prePointItem        = item;
    }
Exemple #12
0
    /// <summary>
    /// 加载设备信息
    /// </summary>
    public void LoadDeviceRecord()
    {
        Logger.Instance.WriteLog("加载设备信息");
        List <DeviceInfo> dInfo;
        DeviceRecordInfo  record;
        DeviceDao         dDao = new DeviceDao();

        dDao.Select001();
        dInfo = dDao.Result;
        bool forbidden = false;

        Records.transform.DestroyChildren();
        for (int i = 0; i < dInfo.Count; i++)
        {
            record       = new DeviceRecordInfo();
            record.No    = "" + (i + 1);
            record.DInfo = dInfo[i];
            forbidden    = false;
            if (!CMSManage.Instance.HasPTZCtl(record.DInfo.Guid))
            {
                forbidden = true;
            }
            GameObject go = Instantiate(RecordItemPrefab) as GameObject;
            go.GetComponent <DeviceRecordItem>().Init(record, PresetPositionWindow, forbidden);
            Records.AddChild(go.transform);
            go.transform.localScale = new Vector3(1, 1, 1);
        }
    }
Exemple #13
0
    public bool Dock(GameObject obj)
    {
        if (!CanDock(obj))
        {
            return(false);
        }

        //进行停靠

        //尝试 道具槽模式
        QKItemSlot itemSlot = WidgetContainer.GetComponent <QKItemSlot>();

        if (itemSlot != null)
        {
            //将对象加入
            obj.transform.parent = itemSlot.gameObject.transform;

            //通知父亲改变
            NGUITools.MarkParentAsChanged(obj);

            //重新算item位置
            itemSlot.Reposition();

            DockItemDone(obj);
            return(true);
        }

        //尝试 grid模式
        UIGrid grid = WidgetContainer.GetComponent <UIGrid>();

        if (grid != null)
        {
            grid.AddChild(obj.transform);

            NGUITools.MarkParentAsChanged(obj);

            DockItemDone(obj);
            return(true);
        }

        //尝试 table模式
        UITable table = WidgetContainer.GetComponent <UITable>();

        if (table != null)
        {
            //将对象加入到table中
            obj.transform.parent = table.gameObject.transform;

            NGUITools.MarkParentAsChanged(obj);

            //重新算item位置
            table.Reposition();

            DockItemDone(obj);
            return(true);
        }

        return(false);
    }
Exemple #14
0
 void Update()
 {
     if (b)
     {
         b = false;
         grid.AddChild(transform);
     }
 }
Exemple #15
0
    private void AddItemToEvacuateAreaItemGrid(EvacuateArea area)
    {
        GameObject go = GameObject.Instantiate(EditedEvacuateAreaListItemPrefab) as GameObject;

        EvacuateAreaListGrid.AddChild(go.transform);
        go.transform.localScale = new Vector3(1, 1, 1);
        go.GetComponent <EditedEvacuateAreaListItem>().Init(area, EvacuateAreaDevicePanel);
    }
Exemple #16
0
    private void AddItemToEvacuatePlanItemGrid(EvacuatePlan plan)
    {
        GameObject go = GameObject.Instantiate(EditedEvacuatePlanListItemPrefab) as GameObject;

        EvacuatePlanItemGrid.AddChild(go.transform);
        go.transform.localScale = new Vector3(1, 1, 1);
        go.GetComponent <EditedEvacuatePlanListItem>().Init(plan, EvacuateAreaOfPlanPanel);
    }
Exemple #17
0
    private void AddItem(int i)
    {
        var childList = mGrid.GetChildListEx();

        if (childList.Count == transform.childCount)
        {
            AddNewItem(i);
        }
        else
        {
            for (var j = 0; j < transform.childCount; j++)
            {
                var t = transform.GetChild(j);
                var b = t.GetComponent <BindDataRoot>();

                if (b.IsBind == false)
                {
                    t.gameObject.SetActive(true);
                    if (mGrid.enabled == false)
                    {
                        mGrid.enabled = true;
                    }
                    mGrid.AddChild(t);
                    break;
                }
            }
            var mList = Source as IList;
            childList = mGrid.GetChildListEx();
            for (var j = i; j < childList.Count; j++)
            {
                var t       = childList[j];
                var binding = t.GetComponent <BindDataRoot>();
                if (binding != null)
                {
                    binding.SetBindDataSource(mList[j]);
                }

                var itemLogic = t.GetComponent <ListItemLogic>();
                if (itemLogic != null)
                {
                    itemLogic.Index = j;
                    itemLogic.Item  = mList[j];
                }
            }
        }
    }
Exemple #18
0
 void AddGrid()
 {
     for (byte i = 0; i < m_NodeList.Count; ++i)
     {
         m_UIGrid.AddChild(m_NodeList[i].m_BaseTrans);
         m_NodeList[i].m_BaseTrans.localScale = Vector3.one;
     }
 }
Exemple #19
0
    void FindFriendOk(COM_ContactInfo req)
    {
        GameObject objCell = null;

        if (_findFriendCellList.Count > 0)
        {
            foreach (GameObject i in _findFriendCellList)
            {
                recomGrid.RemoveChild(i.transform);
                i.gameObject.transform.parent = null;
                i.gameObject.SetActive(false);
                _findFriendCellPool.Add(i);
            }
            _findFriendCellList.Clear();
        }

        if (_findFriendCellPool.Count > 0)
        {
            objCell = _findFriendCellPool[0];
            objCell.SetActive(true);
            FriendRecommendCell cellUI = objCell.GetComponent <FriendRecommendCell>();
            _findFriendCellPool.Remove(objCell);
        }
        else
        {
            objCell = Object.Instantiate(recomCell.gameObject) as GameObject;
            objCell.SetActive(true);
        }

        if (objCell != null)
        {
            FriendRecommendCell cellUI1 = objCell.GetComponent <FriendRecommendCell>();
            cellUI1.ContactInfo = req;
            cellUI1.level_.text = req.level_.ToString();
            //cellUI1.icon.spriteName = req

            if (findPane.gameObject.activeSelf)
            {
                recomGrid.AddChild(objCell.transform);
                objCell.transform.parent = recomGrid.transform;
                cellUI1.callBack         = OnAddFriendList;
                recomGrid.gameObject.SetActive(false);
                recomGrid.gameObject.SetActive(true);
                recomGrid.repositionNow = true;
            }
            else if (blackPane.gameObject.activeSelf)
            {
                findBlackGrid.AddChild(objCell.transform);
                objCell.transform.parent = findBlackGrid.transform;
                cellUI1.callBack         = OnAddBlackList;
                findBlackGrid.gameObject.SetActive(false);
                findBlackGrid.gameObject.SetActive(true);
                findBlackGrid.repositionNow = true;
            }
            objCell.transform.localScale = Vector3.one;
            _findFriendCellList.Add(objCell);
        }
    }
Exemple #20
0
    public void UpdateScrollView()
    {
        List <UIHeroCategory.Hero> herosCategory = _formationHeroCategory.GetSortHero();

        if (!isInitScrllView)
        {
            int i = 0;
            isInitScrllView = true;

            foreach (UIHeroCategory.Hero heroCategory in herosCategory)
            {
                GameObject prefab = Resources.Load(HERO_ITEM_PATH) as GameObject;
                GameObject obj    = NGUITools.AddChild(_grid.gameObject, prefab);
                _grid.AddChild(obj.transform);

                obj.name = UIHelper.GetItemSuffix(++i);

                UIHeroBodyItem heroBodyItem = obj.GetComponent <UIHeroBodyItem> ();
                heroBodyItem.UpdateUI(heroCategory);

                UIHeroHeadItem heroHeadItem = obj.GetComponent <UIHeroHeadItem> ();
                heroHeadItem.UpdateUI(heroCategory.pb_Hero);

                UIHeroDragItem heroDragItem = obj.GetComponent <UIHeroDragItem> ();
                heroDragItem.heroPanel     = this;
                heroDragItem.slotUIManager = _battleFormationPanel.slotUIManager;

                obj.transform.Find("Hero_Head_Sprite").gameObject.SetActive(false);
                obj.transform.Find("Hero_Body_Sprite").gameObject.SetActive(true);
            }

            // scrollView cell 排序
            _grid.animateSmoothly = false;
            _grid.repositionNow   = true;

            // 小于单行最多显示 停止滑动
            if (herosCategory.Count < BattleFormationPanel.UNIT_SHOW_MAX)
            {
                _scrollView.enabled = false;
            }
            else
            {
                _scrollView.enabled = true;
            }
        }
        else
        {
            int id = 0;
            foreach (UIHeroCategory.Hero heroCategory in herosCategory)
            {
                string     cellPath = UIHelper.GetItemSuffix(++id);
                GameObject cell     = _grid.transform.Find(cellPath).gameObject;

                UIHeroBodyItem heroBodyItem = cell.GetComponent <UIHeroBodyItem> ();
                heroBodyItem.UpdateUI(heroCategory);
            }
        }
    }
Exemple #21
0
 void SetPresentListDate()
 {
     SortList();
     for (byte i = 0; i < m_PresentList.Count; ++i)
     {
         m_Grid.AddChild(m_PresentList[i].m_BaseTrans);
         m_PresentList[i].ResetLocalScale();
     }
 }
Exemple #22
0
 void Initshopweapon()
 {
     foreach (int id in weaponidArray)
     {
         GameObject itemGo = NGUITools.AddChild(grid.gameObject, weaponitem);
         grid.AddChild(itemGo.transform);
         itemGo.GetComponent <shopweaponitem>().setid(id);
     }
 }
Exemple #23
0
 void InitShopWeapon()  //初始化武器商店的信息
 {
     foreach (int id in weaponidArray)
     {
         GameObject itemGo = NGUITools.AddChild(grid.gameObject, weaponItem);
         grid.AddChild(itemGo.transform);
         itemGo.GetComponent <ShopWeaponItem>().SetId(id);
     }
 }
Exemple #24
0
    private void AddItemToVideoPatrolPlanGrid(VideoPatrolPlanInfo info)
    {
        GameObject RecordItem = Instantiate(RecordItemPrefab) as GameObject;

        RecordItem.GetComponent <VideoPatrolPlanItem>().Init(info);
        VideoPatrolPlanGrid.AddChild(RecordItem.transform);
        RecordItem.transform.localScale         = new Vector3(1, 1, 1);
        UIEventListener.Get(RecordItem).onClick = ShowPlanDetail;
    }
Exemple #25
0
    public void AddItemTask(string content, ItemAbstract itemAbstract)
    {
        Transform item = Instantiate(ItemTask) as Transform;

        item.GetComponent <ItemTask>().SetData(content, itemAbstract);
        grid.AddChild(item);
        checkShowAskResult  = false;
        DialogTask.complete = false;
    }
    // Need to show cards
    private void takeACard(int playerRequesting, GameObject playerGivingPermission)
    {
        Debug.Log("takeACard with playerRequestion = " + playerRequesting + " playerGivingPermission = " + playerGivingPermission.GetPhotonView().ownerId);
        // Show the Panel

        GameObject    panel = Instantiate(prefabTakePanel);
        List <string> hand  = playerGivingPermission.GetComponent <PlayerMovement> ().myHand;

        UIGrid grid = GameObject.Find("TakeCardPanel(Clone)/panel/Scroll View/Grid").GetComponent <UIGrid>();

        foreach (string card in hand)
        {
            Debug.Log("Player has " + card);
            GameObject cardObject = GameObject.Find(card);
            GameObject go         = NGUITools.AddChild(grid.gameObject, cardObject);
            grid.AddChild(go.transform);
        }

        // Set up events for cards in hand (make them clickable)
        foreach (Transform card in grid.transform)
        {
            if (card.tag == "CityCard")
            {
                foreach (Transform sprite in card.transform)
                {
                    UIButton                button  = sprite.GetComponent <UIButton>();
                    EventDelegate           onClick = new EventDelegate(GameObject.Find("ActionManager").GetComponent <ShareKnowledge>(), "sendRequest");
                    EventDelegate.Parameter param1  = new EventDelegate.Parameter();
                    EventDelegate.Parameter param2  = new EventDelegate.Parameter();
                    EventDelegate.Parameter param3  = new EventDelegate.Parameter();
                    EventDelegate.Parameter param4  = new EventDelegate.Parameter();
                    EventDelegate.Parameter param5  = new EventDelegate.Parameter();

                    param1.value = card.name;
                    param2.value = playerRequesting;                            // int
                    param3.value = "Take";
                    param4.value = playerGivingPermission;
                    param5.value = PhotonNetwork.player.ID;

                    param1.expectedType = card.GetType();
                    param2.expectedType = playerRequesting.GetType();
                    param3.expectedType = ("Take").GetType();
                    param4.expectedType = playerGivingPermission.GetType();
                    param5.expectedType = PhotonNetwork.player.ID.GetType();

                    onClick.parameters[0] = param1;
                    onClick.parameters[1] = param2;
                    onClick.parameters[2] = param3;
                    onClick.parameters[3] = param4;
                    onClick.parameters[4] = param5;

                    EventDelegate.Add(button.onClick, onClick);
                }
            }
        }
    }
Exemple #27
0
    private void SetDurEquips()
    {
        COM_Item[] equips = GamePlayer.Instance.Equips;
        for (int i = 0; i < equips.Length; i++)
        {
            if (equips[i] != null)
            {
                ItemData idate = ItemData.GetData((int)equips[i].itemId_);
                if (idate == null)
                {
                    continue;
                }
                if (idate.slot_ == EquipmentSlot.ES_Ornament_0 || idate.slot_ == EquipmentSlot.ES_Ornament_1 || idate.slot_ == EquipmentSlot.ES_Crystal)
                {
                    continue;
                }
                if (equips[i].durability_ < equips[i].durabilityMax_ * 0.8)
                {
                    durEquips.Add(equips[i]);
                    GameObject obj = Object.Instantiate(itemCell) as GameObject;
                    obj.SetActive(true);
                    obj.GetComponent <BagCellUI>().Item          = equips[i];
                    obj.GetComponent <BagCellUI>().countLab.text = ItemData.GetData((int)equips[i].itemId_).name_;
                    grid.AddChild(obj.transform);
                    obj.transform.localScale = Vector3.one;
                    listCell.Add(obj);
                }
            }
        }
        grid.Reposition();

        if (durEquips.Count <= 0)
        {
            fixBtn.isEnabled        = false;
            parfectFixBtn.isEnabled = false;
            return;
        }
        else
        {
            noFixLab.gameObject.SetActive(false);
        }

        for (int j = 0; j < durEquips.Count; j++)
        {
            int nowMax = durEquips[j].durabilityMax_ - 10;
            nowMax      = nowMax > 60 ? nowMax : 60;
            _needMoney += (nowMax - durEquips[j].durability_) * 50;

            int bnowMax = durEquips[j].durabilityMax_;             //+ 10;
            //	bnowMax = bnowMax > 300 ? 300 : bnowMax;
            _needDiamond += (bnowMax - durEquips[j].durability_) * 1;
        }

        needMoneyLab.text   = _needMoney.ToString();
        needDiamondLab.text = _needDiamond.ToString();
    }
 //when click send button in chatlobby
 public void OnCickSendInLobbyChatBar()
 {
     if (chatInput.value != "")
     {
         GameObject chatItem = NGUITools.AddChild(grid.gameObject, chatPrefab);
         chatItem.transform.Find("content").GetComponent <UILabel>().text = chatInput.value;//更新显示
         grid.AddChild(chatItem.transform);
         chatInput.value = "";
     }
 }
Exemple #29
0
 /// <summary>
 /// 初始化任务面板的任务列表
 /// </summary>
 public void InitTaskList()
 {
     foreach (Task task in TaskManager._instance.GetTaskList())
     {
         GameObject go = NGUITools.AddChild(taskListGrid.gameObject, taskItemPrefab);
         taskListGrid.AddChild(go.transform);
         TaskitemUI taskitemUI = go.GetComponent <TaskitemUI>();
         taskitemUI.InitItem(task);
     }
 }
Exemple #30
0
    /// <summary>
    /// 将摄像头加入到,已选择列表中
    /// </summary>
    /// <param name="no">显示用的序号</param>
    /// <param name="description">摄像头名称</param>
    /// <param name="index">MornitorInfos的位置索引</param>
    /// <param name="time">巡逻停留时间</param>
    private void AddToSelectedMornitorList(int no, string description, int index, string time = "5")
    {
        Logger.Instance.WriteLog("将摄像头加入到,已选择列表中");
        GameObject newGo = Instantiate(SelectedMornitorItemPrefab) as GameObject;

        SelectedMornitorList.AddChild(newGo.transform);
        newGo.transform.localScale = new Vector3(1, 1, 1);
        SetBackground(no, newGo);
        newGo.transform.FindChild("Sort").GetComponent <UILabel> ().text        = SelectedMornitorList.transform.childCount.ToString();
        newGo.transform.FindChild("Description").GetComponent <UILabel> ().text = description;
        UIInput input = newGo.transform.FindChild("Time").GetComponent <UIInput> ();

        input.value = time;
        UIEventListener.Get(newGo.transform.FindChild("Description").gameObject).onDoubleClick = DeleteFromSelectedMornitorList;
        UIEventListener.Get(newGo.transform.FindChild("GotoIcon").gameObject).onDoubleClick    = GotoMornitorPosition;
        UIEventListener.Get(newGo.transform.FindChild("Up").gameObject).onClick   = MoveToUp;
        UIEventListener.Get(newGo.transform.FindChild("Down").gameObject).onClick = MoveToDown;
        SelectedMornitorDictionary.Add(newGo, index);
    }
Exemple #31
0
 private void CreateButton(UIGrid parent, string name, StoreManager.ItemTypes itemType, int id, int price, int cp)
 {
     StoreItem button = PrefabUtility.InstantiatePrefab(itemPrefab) as StoreItem;
     parent.AddChild(button.transform);
     button.transform.localScale = Vector3.one;
     button.Initialize(itemType, id, name, price, cp, this);
     button.GetComponent<SelectableButton>().group = "Store Item";
 }