コード例 #1
0
 public void UpdateGoalUI(GameState gameState)
 {
     foreach (var element in group.GetComponentsInChildren <GoalUIElement>())
     {
         element.UpdateGoal(gameState);
     }
 }
コード例 #2
0
    void InitStoreItem(StoreInfo info, C2G.StoreLimitInfoGetAck ack)
    {
        m_BottomToggle.value = true;
        Array.ForEach(m_Grid.GetComponentsInChildren(typeof(StoreItem), true), i => DestroyImmediate(i.gameObject));
        for (int i = 0; i < info.m_GoodsItem.Count; ++i)
        {
            StoreItem         item       = NGUITools.AddChild(m_Grid.gameObject, StoreItemPrefab).GetComponent <StoreItem>();
            pd_StoreLimitInfo limit_info = null;
            if (ack.infos != null)
            {
                limit_info = ack.infos.Find(e => e.item_id == info.m_GoodsItem[i].ID);
            }

            item.Init(info.m_GoodsItem[i], limit_info);
        }
        m_Grid.Reposition();

        UIScrollView scroll = m_Grid.GetComponentInParent <UIScrollView>();

        if (scroll != null)
        {
            scroll.ResetPosition();
        }
        UpdateBottomDesc();
    }
コード例 #3
0
 override public bool Uninit(bool bBack)
 {
     if (bBack)
     {
         m_Heroes = null;
         Array.ForEach(m_MonsterGrid.GetComponentsInChildren(typeof(DungeonMonster), true), i => Destroy(i.gameObject));
         Array.ForEach(m_RecommendGrid.GetComponentsInChildren(typeof(DungeonHeroRecommend), true), i => Destroy(i.gameObject));
         Array.ForEach(m_RewardGrid.GetComponentsInChildren(typeof(RewardItem), true), i => Destroy(i.gameObject));
     }
     return(true);
 }
コード例 #4
0
 void Filter(string itemClass)
 {
     for (int i = 0; i < itemGrid.GetComponentsInChildren <Transform>(true).Length; i++)
     {
         FMStoreItemUI item = itemGrid.GetComponentsInChildren <Transform>(true)[i].GetComponent <FMStoreItemUI>();
         if (item != null)
         {
             item.gameObject.SetActive(item.Item.ItemClass.Equals(itemClass));
         }
     }
     itemGrid.Reposition();
 }
コード例 #5
0
 void Filter(string itemClass, bool check)
 {
     for (int i = 0; i < grid.GetComponentsInChildren <Transform>(true).Length; i++)
     {
         FMInventoryItemUI item = grid.GetComponentsInChildren <Transform>(true)[i].GetComponent <FMInventoryItemUI>();
         if (item != null && item.Item.ItemClass.Equals(itemClass))
         {
             item.gameObject.SetActive(check);
         }
     }
     grid.Reposition();
 }
コード例 #6
0
 public void selectedAoYi(AoYi aoYi)
 {
     AoYiSlot[] aoYiSlots = aoYiGrid.GetComponentsInChildren <AoYiSlot>();
     for (int i = 0; i < aoYiSlots.Length; i++)
     {
         AoYiSlot aoYiSlotTemp = aoYiSlots[i];
         if (aoYi.AoYiDataConfig.ID == aoYiSlotTemp.aoYi.AoYiDataConfig.ID)
         {
             selectedAoYiSlot(aoYiSlotTemp);
             return;
         }
     }
 }
コード例 #7
0
ファイル: SuccessPopup.cs プロジェクト: dqchess/WaterBlast
        public void SetInfo(int score, int starCount, UIGrid group)
        {
            uiScore.text = score.ToString();

            for (int i = 0; i < starCount; ++i)
            {
                stars[i].Activate();
            }

            foreach (var goal in group.GetComponentsInChildren <GoalUIElement>())
            {
                var goalObject = Instantiate(goal);

                goalObject.gameObject.layer = gameObject.layer;
                goalObject.GetComponent <UIWidget>().depth = 400;

                goalObject.image.depth     = 401;
                goalObject.tickImage.depth = 402;

                goalObject.image.gameObject.layer      = gameObject.layer;
                goalObject.amountText.gameObject.layer = gameObject.layer;
                goalObject.tickImage.gameObject.layer  = gameObject.layer;

                goalObject.transform.SetParent(goalGroup.transform, false);
                goalObject.GetComponent <GoalUIElement>().SetCompletedTick(goal.isCompleted);
            }
        }
コード例 #8
0
 public void UpdateAwardItemState(int nTurnID)
 {
     ActivenessAwardItem[] Item = m_ItemGrid.GetComponentsInChildren <ActivenessAwardItem>();
     for (int i = 0; i < Item.Length; ++i)
     {
         if (Item[i].TurnID == nTurnID)
         {
             Tab_ActivenessAward pAward = TableManager.GetActivenessAwardByID(nTurnID, 0);
             if (pAward == null)
             {
                 LogModule.DebugLog("ActivenessAward: ActivenessAward.txt can't find line " + nTurnID);
                 return;
             }
             AwardState awardState = AwardState.AWARD_CANNNTHAVE;
             bool       bFlag      = GameManager.gameManager.PlayerDataPool.AwardActivityData.GetActivenessAwardFlag(nTurnID);
             if (bFlag == false && Activeness > pAward.MiniActiveness)
             {
                 awardState = AwardState.AWARD_CANHAVE;
             }
             else if (bFlag == true)
             {
                 awardState = AwardState.AWARD_HAVEDONE;
             }
             else
             {
                 awardState = AwardState.AWARD_CANNNTHAVE;
             }
             Item[i].AwardButtonState = awardState;
             return;
         }
     }
 }
コード例 #9
0
    /** 刷新活动时间 */
    private void refreshNoticeTime()
    {
        long remainTime = noticeOpenTime - ServerTimeKit.getSecondTime();

        if (remainTime <= 0)
        {
            long remainCloseTime = noticeCloseTime - ServerTimeKit.getSecondTime();
            if (remainCloseTime >= 0)
            {
                timeText.gameObject.SetActive(true);
                timeText.text = closeTimeNoticeText.Replace("%1", TimeKit.timeTransformDHMS(remainCloseTime));
            }
            else
            {
                timeText.gameObject.SetActive(false);
                timer.stop();
                timer = null;
                //时间到后所有按钮置灰
                LimitCollectItemUI[] items = content.GetComponentsInChildren <LimitCollectItemUI>();
                for (int i = 0; i < items.Length; i++)
                {
                    items[i].receiveButton.disableButton(true);
                }
                UiManager.Instance.createMessageLintWindow(LanguageConfigManager.Instance.getLanguage("notice37"));
            }
        }
        /** 还没开启 */
        else
        {
            timeText.gameObject.SetActive(true);
            timeText.text = openTimeNoticeText.Replace("%1", TimeKit.timeTransformDHMS(remainTime));
        }
    }
コード例 #10
0
    void BtnClick(GameObject go)
    {
        string name = go.name;

        switch (name)
        {
        case "Btn_TJ":    //玩家统计
            PLayerJF.SetActive(false);
            PlayerTJ.SetActive(true);
            break;

        case "Btn_JF":    //统计记录
            PlayerTJ.SetActive(false);
            PLayerJF.SetActive(true);
            break;

        case "Btn_Close":    //关闭按钮
            PlayerJF_Item[] fjs = PlayerJFGrid.GetComponentsInChildren <PlayerJF_Item>();
            foreach (var jf in fjs)
            {
                ResourcesMgr.m_Instance.RemoveGameObject(jf.gameObject);
            }
            ResourcesMgr.m_Instance.RemoveGameObject(this.gameObject);
            break;
        }
    }
コード例 #11
0
        protected virtual void Initialize(Model[] models)
        {
            mGridContaints.transform.localPosition = mVector3_GridContaintsDefaultPosition;
            MaxLogicViewObjects = GetUserViewingLength() + GetReliminaryLength();
            Models                   = models;
            RollCount                = 0;
            CursolIndex              = 0;
            AnimationScrollNow       = false;
            AnimationViewPositionNow = false;
            DestroyGridInChildren();
            View viewPrefab = GetViewPrefab();

            for (int i = 0; i < GetLogicViewingLength(); i++)
            {
                View component = Util.Instantiate(viewPrefab.gameObject, mGridContaints.gameObject).GetComponent <View>();
                component.SetOnActionListener(OnChildAction);
            }
            mGridContaints.Reposition();
            Views = mGridContaints.GetComponentsInChildren <View>();
            ViewsDefaultLocalPosition = new Vector3[Views.Length];
            int num = 0;

            View[] views = Views;
            for (int j = 0; j < views.Length; j++)
            {
                View val = views[j];
                ViewsDefaultLocalPosition[num++] = val.cachedTransform.localPosition;
            }
            OnInitialize(RollCount);
        }
コード例 #12
0
    public void OnSelectedWeaponsChanged()
    {
        // destroy current
        while (selectedEquipmentsGrid.transform.childCount > 0)
        {
            var t = selectedEquipmentsGrid.transform.GetChild(0);
            t.parent = null;
            Destroy(t.gameObject);
        }

        CloseWeaponItem.GetComponent <WeaponSelectionItem>().icon.enabled = false;
        CloseWeaponItem.GetComponent <WeaponSelectionItem>().selected     = false;
        CloseWeaponItem.GetComponent <UISprite>().enabled = false;
        // rebuild selected
        var allItems = allEquipmentsGrid.GetComponentsInChildren <WeaponSelectionItem>();

        foreach (var i in allItems)
        {
            if (i.selected)
            {
                i.icon.color = new Color(0.3f, 0.3f, 0.3f);

                if (i.WeaponType < WeaponType.gun_area)
                {
                    CloseWeaponItem.GetComponent <UISprite>().enabled = true;
                    CloseWeaponItem.GetComponent <WeaponSelectionItem>().icon.enabled    = true;
                    CloseWeaponItem.GetComponent <WeaponSelectionItem>().icon.spriteName = i.icon.spriteName;
                    CloseWeaponItem.GetComponent <WeaponSelectionItem>().parent          = i;
                    CloseWeaponItem.GetComponent <WeaponSelectionItem>().WeaponType      = i.WeaponType;
                    CloseWeaponItem.GetComponent <WeaponSelectionItem>().icon.color      = Color.white;
                    CloseWeaponItem.GetComponent <WeaponSelectionItem>().selected        = true;
                }
                else
                {
                    var go = Instantiate(i.gameObject) as GameObject;
                    go.transform.parent        = selectedEquipmentsGrid.transform;
                    go.transform.localPosition = Vector3.zero;
                    go.transform.localScale    = Vector3.one;
                    go.GetComponent <WeaponSelectionItem>().parent = i;
                    //				go.collider.enabled = false;
                    go.GetComponent <WeaponSelectionItem>().WeaponType = i.WeaponType;
                    go.GetComponent <WeaponSelectionItem>().icon.color = Color.white;
                }
            }
        }
        selectedEquipmentsGrid.Reposition();

        // update data
        GameData.Instance.selectedWeapons.Clear();
        foreach (var i in selectedEquipmentsGrid.GetComponentsInChildren <WeaponSelectionItem>())
        {
            GameData.Instance.selectedWeapons.Add(i.WeaponType);
        }

        if (CloseWeaponItem.GetComponent <WeaponSelectionItem>().icon.enabled)
        {
            GameData.Instance.selectedWeapons.Add(CloseWeaponItem.GetComponent <WeaponSelectionItem>().WeaponType);
        }
    }
コード例 #13
0
ファイル: UIPhoneWnd.cs プロジェクト: shrubba/planetexplorers
    //lz-2016.06.12 根据ck的多少居中显示
    void UpdateCksPos()
    {
        mCksGrid.Reposition();
        UICheckbox[] chArray = mCksGrid.GetComponentsInChildren <UICheckbox>(false);
        int          count   = (null == chArray) ? 0 : chArray.Length;

        mCksGrid.transform.localPosition = new Vector3(-mCksGrid.cellWidth * (count - 1) * 0.5f, mCksGrid.transform.localPosition.y, mCksGrid.transform.localPosition.z);
    }
コード例 #14
0
 public void OnDisable()
 {
     ScoreItemCtr[] arrays = m_DetailScore.GetComponentsInChildren <ScoreItemCtr>();
     foreach (var item in arrays)
     {
         ResourcesMgr.m_Instance.RemoveGameObject(item.gameObject);
     }
 }
コード例 #15
0
 public void UpdateMissionState(int nMissionID)
 {
     DailyMissionItemLogic[] Item = m_ItemGrid.GetComponentsInChildren <DailyMissionItemLogic>();
     for (int i = 0; i < Item.Length; ++i)
     {
         if (Item[i] && Item[i].MissionID == nMissionID)
         {
             Item[i].UpadateButtonState(nMissionID);
             break;
         }
     }
     if (m_ItemGrid)
     {
         m_ItemGrid.repositionNow = true;
         m_ItemGrid.sorted        = true;
     }
 }
コード例 #16
0
    void Init()
    {
        //List<Announcement> events = new List<Announcement>(GameManager.Instance.ListAnnouncement.FindAll(a => a.show == Announcement.Scene.announce && a.type == Announcement.Type.Event));
        //if (events.Count > 0)
        //{
        //    foreach (Announcement ev in events)
        //        AnnounceItemEvent.Create(tableEvent.transform, ev, tableEvent.transform.parent.GetComponent<UIDraggablePanel>());
        //    tableEvent.repositionNow = true;
        //}

        //List<Announcement> advertisement = new List<Announcement>(GameManager.Instance.ListAnnouncement.FindAll(a => a.show == Announcement.Scene.announce && a.type == Announcement.Type.Advertisement));
        //if (advertisement.Count > 0)
        //{
        //    foreach (Announcement ads in advertisement)
        //        AnnounceItemAds.Create(tableAds.transform, ads, tableAds.transform.parent.GetComponent<UIDraggablePanel>());
        //    tableAds.repositionNow = true;
        //}

        #region QUÀ TẶNG MỖI NGÀY

        List <Announcement> gifts = new List <Announcement>(GameManager.Instance.ListAnnouncement.FindAll(a => a.show == Announcement.Scene.announce && a.type == Announcement.Type.Gift));
        gifts.ForEach(g => AnnounceItemGift.Create(tableGift.transform, g));

        tableGift.repositionNow = true;


        GameManager.Instance.FunctionDelay(delegate()
        {
            tableGift.GetComponent <UICenterOnChild>().Recenter();
        }, 0.05f);
        GameManager.Instance.FunctionDelay(delegate()
        {
            tableGift.GetComponent <UICenterOnChild>().onFinished = OnDragFinishGift;
            OnDragFinishGift();
        }, 0.1f);
        GameManager.Instance.FunctionDelay(delegate()
        {
            AnnounceItemGift itemCurrentDay = Array.Find <AnnounceItemGift>(tableGift.GetComponentsInChildren <AnnounceItemGift>(), g => g.item.currentDay == true);
            if (itemCurrentDay != null)
            {
                tableGift.GetComponent <UICenterOnChild>().CenterOn(itemCurrentDay.transform);
            }
        }, 0.15f);
        #endregion
    }
コード例 #17
0
ファイル: PopupChat.cs プロジェクト: tapenjoyGame/cry
 void OnDragFinished(bool is_force)
 {
     if (is_force == true || (need_refresh == true && DraggedScrollView == false))
     {
         Array.ForEach(ChatLineGrid.GetComponentsInChildren <PopupChatLine>(), line => ChatLinePrefabManager.Free(line.gameObject));
         MessageDraw();
         need_refresh = false;
     }
 }
コード例 #18
0
    public static UISlicedSprite[] GetSpritesFromGrid(UIGrid grid, out GameObject centerObject)
    {
        UISlicedSprite[] sprites = grid.GetComponentsInChildren <UISlicedSprite>();

        centerObject = null;
        if (grid.gameObject.GetComponent <UICenterOnChild>() != null)
        {
            centerObject = grid.gameObject.GetComponent <UICenterOnChild>().centeredObject;
        }

        return(sprites);
    }
コード例 #19
0
    // Use this for initialization
    void Start()
    {
        lst_CheckBoxes = new List <OnOffCheckBox>();

        OnOffCheckBox[] chk_Boxes = grid.GetComponentsInChildren <OnOffCheckBox>();

        for (int i = 0; i < chk_Boxes.Length; i++)
        {
            chk_Boxes[i].SetToggleGroup(20 + i);

            lst_CheckBoxes.Add(chk_Boxes[i]);
        }
    }
コード例 #20
0
    public void SelectFinish()
    {
        List <Spawner> uses = new List <Spawner>();

        UICard[] cards = selectGrid.GetComponentsInChildren <UICard>();

        for (int i = 0; i < cards.Length; i++)
        {
            uses.Add(cards[i].getSpawner());
        }

        UnitCenter.instance.setUseSpawnerList(uses);
    }
コード例 #21
0
        public override void Awake()
        {
            base.Awake();
            var t = mDMono.transform;
            AwardInfo = new GrowUpFinalAward();
            AwardInfo.MainIcon = t.GetComponent <UISprite>("View1/HeroAward/InfoItem/Icon");
            AwardInfo.RoleIcon = t.GetComponent<UISprite>("View1/HeroAward/InfoItem/Role");
            AwardInfo.GradeIcon = t.GetComponent<UISprite>("View1/HeroAward/InfoItem/Grade");
            AwardInfo.CurSlider = t.GetComponent<UISlider>("View1/HeroAward/ProgressBar");
            AwardInfo.NumLabel = t.GetComponent<UILabel>("View1/HeroAward/ProgressBar/Label");
            AwardInfo.HeroItem = t.Find("View1/HeroAward/InfoItem").gameObject;
            AwardInfo.HeroItem.GetComponent<UIButton>().onClick.Add(new EventDelegate(OnFinalAwardClick));
            AwardInfo.ShowItem = t.GetMonoILRComponent<LTShowItem>("View1/HeroAward/GeneralItem");

            RuleBtn = t.GetComponent<UIButton>("View1/HeroAward/RuleBtn");
            RuleBtn.onClick.Add(new EventDelegate (OnRuleBtnClick));

            DayLabel = t.GetComponent<UILabel>("TaskView/TimeLabel/DayLabel");
            TimeLabel = t.GetComponent<UILabel>("TaskView/TimeLabel/TimeLabel");

            DayItem = t.Find("View1/Item").gameObject;
            DayGrid = t.GetComponent<UIGrid>("View1/ScrollView/Placeholder/Grid");

            TypeBtns = new List<GrowUpTypeBtn>();
            TypeGrid = t.GetComponent<UIGrid>("TaskView/TopBtns");
            UIButton[] btns = TypeGrid.GetComponentsInChildren<UIButton>(true);
            for (int i = 0; i < btns.Length; i++)
            {
                UILabel Label = btns[i].transform.GetComponent<UILabel>("Label");
                UISprite sprite = btns[i].transform.GetComponent<UISprite>("Sprite");
                GameObject RRObj = btns[i].transform.Find("RedPoint").gameObject;
                TypeBtns.Add(new GrowUpTypeBtn(i, btns[i], sprite, Label, RRObj, setBtnEvent(i)));
            }

            AwardItem = t.Find("TaskView/Item").gameObject;
            AwardGrid = t.GetComponent<UIGrid>("TaskView/ScrollView/Placeholder/Grid");
            m_RewardBtn = t.GetComponent<UIButton>("View1/HeroAward/RewardBtn");
            m_RewardBtn.onClick.Add(new EventDelegate(OnRewardBtnClick));
            m_RewardBtnLabel = t.GetComponent<UILabel>("View1/HeroAward/RewardBtn/Label");

            mDayList = new List<LTWelfareGrowUpTabitem>();
            mTasksList = new List<LTWelfareGrowUpTaskItem>();

            timeFinal = 0;
            ActivityOver = false;

            WelfareGrowUpUpdata();
        }
コード例 #22
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     if (instance != this)
     {
         Destroy(gameObject);
     }
     Deck       = GetComponent <Deck>();
     Collection = new List <Card>();
     Collection.AddRange(UICollection.GetComponentsInChildren <Card>());
     CreateDeckFromConfig();
 }
コード例 #23
0
    void InitForPlace()
    {
        m_Panel.SetActive(true);
        //m_ItemSale.gameObject.SetActive(false);

        m_LabelPanelName.text = Localization.Get("StuffPlace");
        Array.ForEach(m_Grid.GetComponentsInChildren(typeof(PopupStuffPlaceItem), true), i => DestroyImmediate(i.gameObject));
        for (int i = 0; i < m_Info.DropInfo.menus.Count; ++i)
        {
            var menu = m_Info.DropInfo.menus[i];
            if (menu.menu == GameMenu.Dungeon)
            {
                if (MapInfoManager.Instance.ContainsKey(menu.menu_parm_1) == true)
                {
                    var map_info = MapInfoManager.Instance.GetInfoByID(menu.menu_parm_1);
                    if (map_info.IDN > GameConfig.Get <int>("contents_open_main_map"))
                    {
                        continue;
                    }
                }
                else
                {
                    continue;
                }
            }

            GameObject obj  = NGUITools.AddChild(m_Grid.gameObject, placeItemPrefab);
            var        item = obj.GetComponent <PopupStuffPlaceItem>();
            item.Init(menu, OnClickItemLocation);
            obj.SetActive(true);
        }
        m_Grid.Reposition();

        UIScrollView scrollView = m_Grid.gameObject.GetComponentInParent <UIScrollView>();

        if (scrollView != null)
        {
            scrollView.ResetPosition();
        }
    }
コード例 #24
0
    void Start()
    {
        scrollView.GetComponent <UIPanel>().depth = panel.depth + 5;

        var buttons = grid_tab.GetComponentsInChildren <UIButton>();

        EventDelegate del1 = new EventDelegate(this, "OnClickTab");

        del1.parameters[0].value = Main.AchivementTab.Weekly;
        buttons[0].onClick.Add(del1);

        EventDelegate del2 = new EventDelegate(this, "OnClickTab");

        del2.parameters[0].value = Main.AchivementTab.Daily;
        buttons[1].onClick.Add(del2);

        EventDelegate del3 = new EventDelegate(this, "OnClickTab");

        del3.parameters[0].value = Main.AchivementTab.Hero;
        buttons[2].onClick.Add(del3);

        EventDelegate del4 = new EventDelegate(this, "OnClickTab");

        del4.parameters[0].value = Main.AchivementTab.Battle;
        buttons[3].onClick.Add(del4);

        EventDelegate del5 = new EventDelegate(this, "OnClickTab");

        del5.parameters[0].value = Main.AchivementTab.Construct;
        buttons[4].onClick.Add(del5);

        EventDelegate del6 = new EventDelegate(this, "OnClickTab");

        del6.parameters[0].value = Main.AchivementTab.Player;
        buttons[5].onClick.Add(del6);

        OnClickTab(current_tab);
        WrapSetting();
    }
コード例 #25
0
    /// <summary>
    /// 向数据库插入新的数据
    /// </summary>
    public void Comfirm()
    {
        Logger.Instance.WriteLog("保存用户组信息");
        GroupDao gpDao = new GroupDao();

        gpDao.Insert001(IPTGroupName.value);
        if (Authoritys)
        {
            gpDao.Select004(IPTGroupName.value);
            string            groupId        = gpDao.Result [0].Id;
            GroupAuthorityDao gaDao          = new GroupAuthorityDao();
            AuthorityItem[]   AuthorityItems = Authoritys.GetComponentsInChildren <AuthorityItem>();
            foreach (AuthorityItem item in AuthorityItems)
            {
                if (item.isSelected)
                {
                    gaDao.Insert001(groupId, item.AuthInfo.Id);
                }
            }
        }
        GroupRecordManage.Instance.ReloadGroupRecord();
        Close();
    }
コード例 #26
0
        private IEnumerator InitCoroutine(int startModelIdx)
        {
            DestroyChildren();
            int tmpIdx = startModelIdx % maxViewCount;

            for (int index = 0; index < maxViewCount; index++)
            {
                View child = Util.Instantiate(childPrefab.gameObject, container.gameObject).GetComponent <View>();
                child.group = getListGroupNo();
                int modelIdx = startModelIdx + index - tmpIdx;
                if (index < tmpIdx)
                {
                    modelIdx += maxViewCount;
                }
                updateChild(modelIdx, child, GetModel(modelIdx));
            }
            container.Reposition();
            views = container.GetComponentsInChildren <View>();
            CalculateDefaultViewPos();
            bottomDestroyY = (0f - (topDestroyY = GetChildHeight())) * (float)(maxViewCount - 1);
            container.Reposition();
            RefreshPosition(0f);
            swipeEventRegion.SetOnSwipeActionJudgeCallBack(OnSwipeAction);
            if (models.Length > 0)
            {
                views[0].DoSelect();
                cursorIndex = 0;
            }
            View[] array = views;
            for (int i = 0; i < array.Length; i++)
            {
                View child2 = array[i];
                child2.transform.localPosition = defaultViewPos[child2.modelIndex - rollCount];
            }
            yield return(null);
        }
コード例 #27
0
ファイル: UIWin.cs プロジェクト: atom-chen/shisanshui-1
    protected void InitGridActiveItems(UIGrid grid, UIPanel panel)
    {
        if (!grid || !panel)
        {
            return;
        }
        ActiveItems.Clear();
        WinItem[] items = grid.GetComponentsInChildren <WinItem>();
        int       index = 0;

        for (int i = 0; i < items.Length; ++i)
        {
            WinItem item = items[i];
            if (panel.IsVisible(item.transform.position) && item.gameObject.activeSelf)
            {
                item.AnimDelay = this.itemAnimInterval * index++; //enable the open animation
                ActiveItems.Add(item);
            }
            else
            {
                item.AnimDelay = -1; //disable the open animation
            }
        }
    }
コード例 #28
0
    public void ShowKingdomInfo(KingdomTest kingdom)
    {
        currentlySelectedKingdom = kingdom;
        warDropdownMenu.Clear();
        peaceDropdownMenu.Clear();
        for (int i = 0; i < PoliticsPrototypeManager.Instance.kingdoms.Count; i++)
        {
            if (PoliticsPrototypeManager.Instance.kingdoms[i].kingdom.id != kingdom.id)
            {
                warDropdownMenu.AddItem(PoliticsPrototypeManager.Instance.kingdoms[i].kingdom.kingdomName);
            }
        }

        for (int i = 0; i < kingdom.kingdomsAtWarWith.Count; i++)
        {
            peaceDropdownMenu.AddItem(kingdom.kingdomsAtWarWith[i].kingdom.kingdomName);
        }

        lblKingdomInfo.text  = "";
        lblKingdomName.text  = kingdom.kingdomName + "\t # of cities: " + kingdom.cities.Count;
        lblKingdomInfo.text += "Current Lord: " + kingdom.assignedLord.name + "\n";
        lblKingdomInfo.text += "Next in line: \n";
        int succession = 5;

        if (kingdom.royaltyList.successionRoyalties.Count < succession)
        {
            succession = kingdom.royaltyList.successionRoyalties.Count;
        }

        for (int i = 0; i < succession; i++)
        {
            lblKingdomInfo.text += (i + 1).ToString() + ". " + kingdom.royaltyList.successionRoyalties [i].name + "\n";
        }

        lblKingdomInfo.text += "Kingdoms at war with: \n";

        for (int i = 0; i < kingdom.kingdomsAtWarWith.Count; i++)
        {
            lblKingdomInfo.text += (i + 1).ToString() + ". " + kingdom.kingdomsAtWarWith[i].kingdom.kingdomName + "\n";
        }

        RoyaltyListItem[] children = royaltyGrid.GetComponentsInChildren <RoyaltyListItem>();
        for (int i = 0; i < children.Length; i++)
        {
            Destroy(children[i].gameObject);
        }

        for (int i = 0; i < kingdom.royaltyList.allRoyalties.Count; i++)
        {
            GameObject royaltyGO = null;
            if (kingdom.royaltyList.allRoyalties[i].id == kingdom.assignedLord.id)
            {
                if (kingdom.royaltyList.allRoyalties[i].spouse != null && !kingdom.royaltyList.allRoyalties[i].spouse.isDead && !kingdom.royaltyList.allRoyalties.Contains(kingdom.royaltyList.allRoyalties[i].spouse))
                {
                    royaltyGO = Instantiate(royaltyPrefab, royaltyGrid.transform) as GameObject;
                    royaltyGO.transform.localPosition = Vector3.zero;
                    royaltyGO.transform.localScale    = Vector3.one;
                    royaltyGO.GetComponent <RoyaltyListItem>().SetRoyalty(kingdom.royaltyList.allRoyalties[i].spouse);
                }
            }

            if (kingdom.royaltyList.allRoyalties[i].kingdom.id != currentlySelectedKingdom.id)
            {
                continue;
            }

            royaltyGO = Instantiate(royaltyPrefab, royaltyGrid.transform) as GameObject;
            royaltyGO.transform.localPosition = Vector3.zero;
            royaltyGO.transform.localScale    = Vector3.one;
            royaltyGO.GetComponent <RoyaltyListItem>().SetRoyalty(kingdom.royaltyList.allRoyalties[i]);
        }

        if (kingdom.cities.Count >= 4)
        {
            revoltBtn.isEnabled = true;
        }
        else
        {
            revoltBtn.isEnabled = false;
        }

        royaltyGrid.GetComponent <UIGrid>().enabled = true;
        kingdomInfoWindowGO.SetActive(true);
        HideRoyaltyInfo();
    }
コード例 #29
0
ファイル: UIHelper.cs プロジェクト: azanium/TruthNIslam-Unity
    public static UISlicedSprite[] GetSpritesFromGrid(UIGrid grid, out GameObject centerObject)
    {
        UISlicedSprite[] sprites = grid.GetComponentsInChildren<UISlicedSprite>();

        centerObject = null;
        if (grid.gameObject.GetComponent<UICenterOnChild>() != null)
        {
            centerObject = grid.gameObject.GetComponent<UICenterOnChild>().centeredObject;
        }

        return sprites;
    }
コード例 #30
0
ファイル: ReChargeWindow.cs プロジェクト: wuxin0602/Nothing
 void Awake()
 {
     reChargeItemGrid = Utils.FindChild(transform, "Grid").GetComponent<UIGrid>();
     closeBTN = UIEventListener.Get(Utils.FindChild(transform, "CloseBTN").gameObject);
     ReChargeButtons = reChargeItemGrid.GetComponentsInChildren<UIButton>();
 }