Example #1
0
        public void AddCL_Object()
        {
            int classifyval = ObjectClassify.Classify.Value;

            if (classifyval == -1)
            {
                classifyval = (int)CL_ObjType.Custom;
            }
            string clobjname = "自定义物体";

            for (int i = 1; resourceLoad.CL_Objects.ContainsKey(clobjname); i++)
            {
                clobjname = "自定义物体" + i;
            }
            CL_Object SelectObj = new CL_Object()
            {
                Name      = clobjname,
                Type      = (CL_ObjType)classifyval,
                Model     = 0,
                ModelSize = 1
            };

            resourceLoad.CL_Objects[SelectObj.Name] = SelectObj;
            ObjectClassify.LoadInfo(resourceLoad);
            ObjectClassify.Classify.OptionClick((int)SelectObj.Type);
            int nowval = ObjectClassify.Thumbnail.Options.FindIndex(s => ((CL_Object)s).Name == SelectObj.Name);

            ObjectClassify.Thumbnail.OptionClick(nowval);
        }
Example #2
0
    /// <summary>
    /// 通过名字来选择模型信息
    /// </summary>
    /// <param name="modelId"></param>
    public void UpdateSelectData(string name)
    {
        //销毁物体
        //这里有个问题,物体销毁后,容器没清空
        foreach (GameObject o in DataObjList)
        {
            GameObject.Destroy(o);
        }
        DataObjList.Clear();

        CL_Object cl_Object = new CL_Object();// = ResourceLoad.resourceLoad.GetObjectInfoByName(name);

        FieldInfo[] info = ClassOperation.GetClassFields(cl_Object);

        //容器
        if (cl_Object.Type == CL_ObjType.Vessel)
        {
            foreach (FieldInfo p in info)
            {
                InitDataBar(Dic_translations[p.Name], p.GetValue(cl_Object).ToString());
            }
        }
        //非容器类型
        else
        {
            foreach (FieldInfo p in info)
            {
                if (p.Name != "VesselVolume" && p.Name != "Liquidvolume" && p.Name != "LiquidTemperature")
                {
                    InitDataBar(Dic_translations[p.Name], p.GetValue(cl_Object).ToString());
                }
            }
        }
    }
Example #3
0
 public void LoadInfo(ResourceLoad resourceLoad)
 {
     SelectObj = null;
     Thumbnail.Clear();
     typeclassify.Clear();
     string[] classifynames = Enum.GetNames(typeof(CL_ObjType));
     Classify.SetOPtions(classifynames);
     Thumbnail.OtherData = resourceLoad;
     foreach (string clfy in classifynames)
     {
         typeclassify[clfy] = resourceLoad.GetObjectInfoByClassify(clfy);
     }
 }
Example #4
0
 public void ReNameSceneObject(string oldname, string newname)
 {
     for (int i = 0; i < resourceLoad.SceneObjects.Count; i++)
     {
         var temp      = resourceLoad.SceneObjects[i];
         var clgameobj = temp.GetComponent <CLGameObject>();
         if (clgameobj.cl_object.Name == oldname)
         {
             CL_Object clobj = resourceLoad.GetObjectInfoByName(newname);
             clobj.Id = clgameobj.cl_object.Id;
             clgameobj.Load(resourceLoad, clobj);
         }
     }
 }
 public CL_Object(CL_Object clobj)
 {
     this.Name              = clobj.Name;
     this.Model             = clobj.Model;
     this.ModelSize         = clobj.ModelSize;
     this.Operations        = new List <Operation>(clobj.Operations);
     this.Type              = clobj.Type;
     this.Liquidvolume      = clobj.Liquidvolume;
     this.LiquidTemperature = clobj.LiquidTemperature;
     this.LiquidColor       = clobj.LiquidColor;
     this.Id         = clobj.Id;
     this.Position   = clobj.Position;
     this.EulerAngle = clobj.EulerAngle;
 }
Example #6
0
        public void ObjectThumbnailClick(int value)
        {
            if (value < 0 || value >= Thumbnail.Options.Count)
            {
                SelectObj = null;
                return;
            }
            var clobj = (Thumbnail.Options[value] as CL_Object);

            SelectObj = clobj;

            if (OnSelectClObject != null)
            {
                OnSelectClObject(clobj);
            }
        }
Example #7
0
        private void showDataView(CL_Object clobj)
        {
            //SelectObj = clobj;
            var keyvals = Tool.GetFieldInfo(clobj);

            if (keyvals["Type"].ToString() == "Common")
            {
                keyvals.Remove("VesselVolume");
                keyvals.Remove("Liquidvolume");
                keyvals.Remove("LiquidTemperature");
                keyvals.Remove("LiquidColor");
            }
            int val = ObjectDataArea.Value;

            ObjectDataArea.SetOPtions(keyvals);
            ObjectDataArea.OptionClick(val);
        }
Example #8
0
        private void SelectObjectThumb(CL_Object clobj)
        {
            if (ModelInit != null)
            {
                Destroy(ModelInit.gameObject);
            }
            var     prefab = resourceLoad.GetPrefabsByModelId(clobj.Model);
            Ray     ray    = Camera.main.ScreenPointToRay(Input.mousePosition);
            Vector3 pos    = Tool.GetRayPointFromY(ray.origin, ray.direction, 0);
            var     obj    = Instantiate(prefab, pos, prefab.transform.rotation);

            obj.transform.localScale *= clobj.ModelSize;
            obj.GetComponent <Collider>().isTrigger = true;
            ModelInit = obj.AddComponent <ModelInit>();
            ModelInit.CanInitMaterial    = CanInitMaterial;
            ModelInit.NotCanInitMaterial = NotCanInitMaterial;
        }
Example #9
0
 private void Update()
 {
     if (resourceLoad == null)
     {
         return;
     }
     if (resourceLoad.IsEdit)
     {
         CL_Object clobj = resourceLoad.GetObjectInfoByName(cl_object.Name);
         if (clobj != null)
         {
             clobj.Id = cl_object.Id;
             Load(resourceLoad, clobj);
         }
     }
     else
     {
         if (EventsManager.AnyObjectCompare != null)
         {
             EventsManager.AnyObjectCompare(cl_object);
         }
     }
 }
Example #10
0
 public void Load(ResourceLoad res, CL_Object clobj)
 {
     resourceLoad = res;
     if (defaultsize == null)
     {
         defaultsize = transform.localScale;
     }
     if (resourceLoad == null)
     {
         return;
     }
     cl_object = new CL_Object(clobj);
     if (cl_object == null)
     {
         return;
     }
     transform.localScale = (Vector3)defaultsize * cl_object.ModelSize;
     cl_object.Position   = transform.position;
     cl_object.EulerAngle = transform.eulerAngles;
     if (cl_object.Id == null)
     {
         cl_object.Id = Guid.NewGuid().ToString();
     }
 }