示例#1
0
            public ChildData(Transform child)
            {
                // Main.Logger.Log("创建一个");
                gameObject = child.gameObject;
                // Main.Logger.Log("aaa");
                setListActor = gameObject.GetComponent <SetListActor>();

                // Main.Logger.Log("获取" + setListActor);
                GameObject obj = GameObject.Instantiate <GameObject>(setListActor.listActorNameText.gameObject);

                // Main.Logger.Log("aaa");
                des = obj.GetComponent <Text>();
                // Main.Logger.Log("aaa");
                des.color = Color.red;
                // Main.Logger.Log("aaa");
                RectTransform tf = obj.GetComponent <RectTransform>();

                // Main.Logger.Log("aaa");
                tf.SetParent(gameObject.transform, false);
                // Main.Logger.Log("aaa");
                tf.sizeDelta = new Vector2(tf.sizeDelta.y, tf.sizeDelta.y);
                // Main.Logger.Log("aaa");
                tf.anchoredPosition = new Vector2(-30, 15);
                // Main.Logger.Log("aaa");

                foreach (var item in child)
                {
                    // Main.Logger.Log("... " + item);
                }

                select   = child.Find("ListActorLabel").GetComponent <Image>();
                des.text = "赠";
            }
示例#2
0
        private void SetCell(ItemCell itemCell, int index)
        {
            // Main.Logger.Log(index.ToString() + "设置 itemCell。。。" + itemCell.ToString() + " pos=" + scrollRect.verticalNormalizedPosition.ToString());
            ActorItem item = itemCell as ActorItem;

            if (item == null)
            {
                // Main.Logger.Log("WarehouseItem出错。。。");
                return;
            }
            // Main.Logger.Log("数据长度:" + m_data.Length);
            ChildData[] childDatas = item.childDatas;
            for (int i = 0; i < lineCount; i++)
            {
                int idx = (index - 1) * lineCount + i;
                // Main.Logger.Log("循环" + i + "获取第【" + idx + "】个元素的数据");
                if (i < childDatas.Length)
                {
                    ChildData  childData = childDatas[i];
                    GameObject go        = childData.gameObject;
                    if (idx < m_data.Length)
                    {
                        go.transform.parent.gameObject.SetActive(true);
                        if (!go.activeSelf)
                        {
                            go.SetActive(true);
                        }
                        int num2 = m_data[idx];
                        itemCell.name = "Actor," + num2;
                        // Main.Logger.Log("改名A:" + itemCell.name);
                        if (itemCell.transform.childCount > i)
                        {
                            var child = itemCell.transform.GetChild(i);
                            child.name = "Actor," + num2;
                            // Main.Logger.Log("改名B:" + itemCell.name);
                            //Toggle tog = child.GetComponent<Toggle>();
                            //tog.group = ActorMenu.instance.listActorsHolder.GetComponent<ToggleGroup>();
                            // Main.Logger.Log(ActorMenu.instance.acotrId +" "+ num2 + "判断是否选中:" + (ActorMenu.instance.acotrId == num2));
                            //tog.isOn = ActorMenu.instance.acotrId == num2;
                            if (ActorMenu.instance.acotrId == num2 && ActorMenuActorListPatch.giveActorId == num2)
                            {
                                childData.Select(SelectState.All);
                            }
                            else if (ActorMenu.instance.acotrId == num2)
                            {
                                childData.Select(SelectState.Select);
                            }
                            else if (ActorMenuActorListPatch.giveActorId == num2)
                            {
                                childData.Select(SelectState.Give);
                            }
                            else
                            {
                                childData.Select(SelectState.Node);
                            }
                            Button btn = child.GetComponentInChildren <Button>();
                            btn.onClick.RemoveAllListeners();
                            btn.onClick.AddListener(delegate()
                            {
                                ActorMenu.instance.SetActorAttr(int.Parse(go.name.Split(',')[1]));
                            });
                        }


                        SetListActor component = childData.setListActor;
                        component.SetActor(num2);

                        // Main.Logger.Log("此处是一些处理 不同身份的人处理方式不同");
                        if (!ActorMenu.instance.isEnemy)
                        {
                            if (num2 == DateFile.instance.MianActorID())
                            {
                                // Main.Logger.Log("主角");
                                component.SetInTeamIcon(true);
                                component.SetInBuildingIcon(false);
                                component.RestMoodFace();
                                component.listActorFavorText.text   = "";
                                component.listActorSamsaraText.text = "";
                            }
                            else if (DateFile.instance.acotrTeamDate.Contains(num2))
                            {
                                // Main.Logger.Log("是出战队员");
                                component.SetInTeamIcon(true);
                                component.SetInBuildingIcon(false);
                                component.RestMoodFace();
                            }
                            else if (DateFile.instance.ParseInt(DateFile.instance.GetActorDate(num2, 27, addValue: false)) == 1)
                            {
                                // Main.Logger.Log("不知道是啥");
                                component.SetInTeamIcon(false);
                                component.SetInBuildingIcon(false);
                                component.RestMoodFace();
                            }
                            else if (DateFile.instance.ActorIsWorking(num2) != null)
                            {
                                // Main.Logger.Log("正在工作的?");
                                component.SetInTeamIcon(false);
                                component.SetInBuildingIcon(true);
                                component.RestMoodFace();
                            }
                            else
                            {
                                // Main.Logger.Log("其他");
                                component.SetInTeamIcon(false);
                                component.SetInBuildingIcon(false);
                                component.RestMoodFace();
                            }
                        }
                        else
                        {
                            // Main.Logger.Log("敌人");
                            component.SetInTeamIcon(false);
                            component.SetInBuildingIcon(false);
                            component.RestMoodFace();
                        }
                    }
                    else
                    {
                        if (go.activeSelf)
                        {
                            go.SetActive(false);
                        }
                    }
                    if (i == 0 && !go.transform.parent.gameObject.activeSelf)
                    {
                        go.transform.parent.gameObject.SetActive(true);
                    }
                }
                else
                {
                    // Main.Logger.Log("数据出错。。。");
                }
                // Main.Logger.Log("人物设置完毕");
            }
        }