public GameObject CreateMatchingMaterial(StudyCollectBtn collectBtnClick, StudyDrop dropItem, DragItem dragitem) { GameObject objResource = Resources.Load("matching/" + collectBtnClick.material.ToString()) as GameObject; if (objResource == null) { return(null); } GameObject processBarObj = Instantiate(objResource, Vector3.zero, Quaternion.identity) as GameObject; // processBarObj.name = collectBtnClick.material.ToString(); RectTransform rectans = processBarObj.GetComponent <RectTransform>(); rectans.SetParent(this.GetComponent <RectTransform>()); rectans.SetAsLastSibling(); rectans.localScale = Vector3.one; rectans.anchoredPosition = new Vector2(0, 0); this.inUse = true; this.collectBtnClick = collectBtnClick; return(objResource); }
public GameObject CreateParts(StudyCollectBtn collectBtnClick) { if (this.parttans.childCount != 0) { Debug.Log("到这里了"); this.parttans.GetChild(0).GetChild(0).GetComponent <Text>().text = (Int32.Parse(this.parttans.GetChild(0).GetChild(0).GetComponent <Text>().text) + 4).ToString(); if (Int32.Parse(this.parttans.GetChild(0).GetChild(0).GetComponent <Text>().text) == 20) { this.dialogmanager.ClickNextDialog(); this.assemImage.gameObject.SetActive(true); this.okImage.SetActive(true); haloFlashImage.SetActive(true); } return(null); } #region MyRegion /* if (this.currentPart != null) * { * currentPart.transform.GetChild(0).GetComponent<Text>().text = * (Int32.Parse(currentPart.transform.GetChild(0).GetComponent<Text>().text) + 4).ToString(); * * * if (Int32.Parse(currentPart.transform.GetChild(0).GetComponent<Text>().text) == 5) * { * // this.btnhaloANI.SetActive(false); * this.dialogmanager.ClickNextDialog(); * this.assemImage.gameObject.SetActive(true); * this.okImage.SetActive(true); * haloFlashImage.SetActive(true); * } * return null; * }*/ #endregion GameObject objResouce = null; objResouce = Resources.Load("parts/" + collectBtnClick.material.ToString()) as GameObject; if (objResouce == null) { return(null); } // Vector2 pos = new Vector2(collectBtnClick.materialPanelIndex * 121 + -396, 233); GameObject processBarObj = Instantiate(objResouce) as GameObject; //设置当前部件的名字 processBarObj.name = collectBtnClick.material.ToString(); RectTransform rectans = processBarObj.GetComponent <RectTransform>(); rectans.transform.SetParent(parttans); rectans.SetAsLastSibling(); // rectans.anchoredPosition = pos; rectans.anchoredPosition = new Vector2(-395, 234); rectans.localScale = Vector3.one; this.currentPart = processBarObj; if (collectBtnClick.material == Material.XYL) { collectBtnClick.materialPanelIndex = 0; } if (this.currentPart != null) { this.currentPart.transform.GetChild(0).GetComponent <Text>().text = (Int32.Parse(this.currentPart.transform.GetChild(0).GetComponent <Text>().text) + 4).ToString(); } return(objResouce); }