예제 #1
0
    /// <summary>
    /// 找到所有门
    /// </summary>
    /// <returns></returns>
    public void InitEntranceList()
    {
        BuildDoorCpt[] doorArray = container.GetComponentsInChildren <BuildDoorCpt>();
        listDoorCpt = TypeConversionUtil.ArrayToList(doorArray);

        BuildStairsCpt[] stairsArray = container.GetComponentsInChildren <BuildStairsCpt>();
        listStairsCpt = TypeConversionUtil.ArrayToList(stairsArray);
    }
예제 #2
0
    /// <summary>
    /// 找到所有桌子
    /// </summary>
    /// <returns></returns>
    public List <BuildBedCpt> InitBedList(InnBuildBean innBuildData)
    {
        if (bedContainer == null)
        {
            return(listBedCpt);
        }
        BuildBedCpt[] tableArray = bedContainer.GetComponentsInChildren <BuildBedCpt>();
        listBedCpt = TypeConversionUtil.ArrayToList(tableArray);
        //设置每张床的美观值
        try
        {
            List <InnResBean> listFurnitureData = innBuildData.GetFurnitureList(2);
            List <InnResBean> listFloorData     = innBuildData.GetFloorList(2);
            List <InnResBean> listWallData      = innBuildData.GetWallList(2);

            Dictionary <Vector3, InnResBean> mapFurnitureData = new Dictionary <Vector3, InnResBean>();
            Dictionary <Vector3, InnResBean> mapFloorData     = new Dictionary <Vector3, InnResBean>();
            Dictionary <Vector3, InnResBean> mapWallData      = new Dictionary <Vector3, InnResBean>();

            foreach (InnResBean innResData in listFurnitureData)
            {
                mapFurnitureData.Add(TypeConversionUtil.Vector3BeanToVector3(innResData.startPosition), innResData);
            }
            foreach (InnResBean innResData in listFloorData)
            {
                mapFloorData.Add(TypeConversionUtil.Vector3BeanToVector3(innResData.startPosition), innResData);
            }
            foreach (InnResBean innResData in listWallData)
            {
                mapWallData.Add(TypeConversionUtil.Vector3BeanToVector3(innResData.startPosition), innResData);
            }

            if (listBedCpt != null)
            {
                for (int i = 0; i < listBedCpt.Count; i++)
                {
                    BuildBedCpt buildBedCpt        = listBedCpt[i];
                    float       totalAddAesthetics = 0;
                    float       totalSubAesthetics = 0;
                    GetAroundAesthetics(mapFurnitureData, buildBedCpt.transform.position, 3, out float addFurnitureAesthetics, out float subFurnitureAesthetics);
                    totalAddAesthetics += addFurnitureAesthetics;
                    totalSubAesthetics += subFurnitureAesthetics;
                    GetAroundAesthetics(mapFloorData, buildBedCpt.transform.position - new Vector3(0.5f, 0.5f), 3, out float addFloorAesthetics, out float subFloorAesthetics);
                    totalAddAesthetics += addFloorAesthetics;
                    totalSubAesthetics += subFloorAesthetics;
                    GetAroundAesthetics(mapWallData, buildBedCpt.transform.position - new Vector3(0.5f, 0.5f), 3, out float addWallAesthetics, out float subWallAesthetics);
                    totalAddAesthetics += addWallAesthetics;
                    totalSubAesthetics += subWallAesthetics;
                    buildBedCpt.SetAddAesthetics((float)decimal.Round(decimal.Parse(totalAddAesthetics + ""), 1), (float)decimal.Round(decimal.Parse(totalSubAesthetics + ""), 1));
                }
            }
        }
        catch
        {
        }
        return(listBedCpt);
    }
예제 #3
0
 /// <summary>
 /// 找到所有桌子
 /// </summary>
 /// <returns></returns>
 public List <BuildTableCpt> InitTableList()
 {
     if (tableContainer == null)
     {
         return(listTableCpt);
     }
     BuildTableCpt[] tableArray = tableContainer.GetComponentsInChildren <BuildTableCpt>();
     listTableCpt = TypeConversionUtil.ArrayToList(tableArray);
     return(listTableCpt);
 }
예제 #4
0
    /// <summary>
    /// string通过指定字符拆分成数组
    /// </summary>
    /// <param name="data"></param>
    /// <param name="substring"></param>
    /// <returns></returns>
    public static List <string> SplitBySubstringForListStr(string data, char substring)
    {
        if (data == null)
        {
            return(new List <string>());
        }
        string[]      splitData = data.Split(new char[] { substring }, StringSplitOptions.RemoveEmptyEntries);
        List <string> listData  = TypeConversionUtil.ArrayToList(splitData);

        return(listData);
    }
예제 #5
0
 /// <summary>
 /// 自动找到rb
 /// </summary>
 public void AutoFindRadioButton()
 {
     if (listButton == null)
     {
         listButton = new List <RadioButtonView>();
     }
     listButton.Clear();
     RadioButtonView[] rbList = GetComponentsInChildren <RadioButtonView>();
     if (rbList != null)
     {
         listButton = TypeConversionUtil.ArrayToList(rbList);
     }
     if (listButton != null)
     {
         foreach (RadioButtonView itemRB in listButton)
         {
             itemRB.SetCallBack(this);
         }
     }
 }
예제 #6
0
 /// <summary>
 /// 获取竞技场2的灶台
 /// </summary>
 /// <returns></returns>
 public List <MiniGameCookingStoveCpt> GetArenaForCookingStoveBy2()
 {
     MiniGameCookingStoveCpt[] listCallBoard = arena_2_Obj_Stove_Container.GetComponentsInChildren <MiniGameCookingStoveCpt>();
     return(TypeConversionUtil.ArrayToList(listCallBoard));
 }