public override void Draw() { GUILayout.BeginArea(myRect, Title, Style); GUILayout.Space(5); GUILayout.BeginHorizontal(); GUILayout.Space(SpacePixel); GUILayout.FlexibleSpace(); GUILayout.BeginVertical(); GUILayout.Space(SpacePixel); GUILayout.BeginHorizontal(); GUILayout.Label("Delay", WhiteTxtStyle, GUILayout.Width(LabelWidth)); Delay = EditorGUILayout.FloatField(Delay); GUILayout.Label("S", WhiteTxtStyle); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.Space(SpacePixel); GUILayout.EndHorizontal(); GUILayout.EndArea(); InPoint.Draw(); OutPoint.Draw(); base.Draw(); }
public void connect(InPoint pInPoint) { pInPoint.disconnect(); pInPoint.connectPoint = this; mConnectPoints.Add(pInPoint); connectPoints = mConnectPoints.ToArray(); }
static void Test() { //Calculate x+y var summ = new Summator(); var summ2 = new Summator(); var summ3 = new Summator(); var str = new Stringer(); var one = new InPoint(new IntColor(1)); var one2 = new OutPoint(new IntColor(1)); var two = new InPoint(new IntColor(2)); var three = new OutPoint(new IntColor(3)); var four = new OutPoint(new IntColor(5)); var mix1 = new MixNode(); one.ConnectTo(summ); two.ConnectTo(summ); one2.ConnectTo(summ).ConnectTo(summ2); three.ConnectTo(summ2).ConnectTo(str); four.ConnectTo(summ2); summ.ConnectTo(summ3); summ2.ConnectTo(summ3); summ3.ConnectTo(str); new OutPoint(new IntColor(6)).ConnectTo(str); //str.ConnectTo(mix1); // new OutPoint(new StringColor("abba")).ConnectTo(mix1);/**/ // graph.Add(new ColorableClass[] { one, two, one2, three }); graph.Add(new ConnectionPoint[] { one, two, one2, three, four }); graph.OnFinish += OnFinish; graph.StartAsync(); }
public void PositionChanged() { transform.position = new Vector3( Mathf.Round(transform.position.x / MainManager.instance.NodeSnap) * MainManager.instance.NodeSnap , Mathf.Round(transform.position.y / MainManager.instance.NodeSnap) * MainManager.instance.NodeSnap ); if (InPoints != null) { foreach (var InPoint in InPoints) { InPoint.UpdateLine(); } } if (OutPoints != null) { foreach (var OutPoint in OutPoints) { foreach (var Out in OutPoint.Outs) { Out.UpdateLine(); } } } }
protected virtual void OnMouseUp() { drag = false; RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero); if (CircuitManager.circuit_tool == CircuitManager.Tool.Circuit) { if (hit.collider != null && hit.collider.gameObject != gameObject && hit.collider.GetComponent <InPoint>()) { InPoint end_point = hit.collider.GetComponent <InPoint>(); if (end_point.In != this) { if (Out != null) { Out.In = null; Out = null; } if (end_point.In != null) { end_point.In.Out = null; } end_point.In = this; Out = end_point; } else if (end_point.In != null) { end_point.In = null; Out = null; } } Draw(); } }
static int Sum(int x, int y) { var xNode = new InPoint(new IntColor(x)); var yNode = new InPoint(new IntColor(y)); int res = 0; var summator = new Summator(); //connect x and y to summato xNode.ConnectTo(summator); yNode.ConnectTo(summator); //both x and y will recieve the same result in this text, so add just one of them graph.Add(xNode); graph.OnFinish += delegate(GraphResult result) { GraphPath path = result[xNode]; if (path != null) { var color = path.LastColor as IntColor; if (color != null) { res = color.Value; } //sum is list of transitions of first value — result is the last one. } }; graph.Start(); return(res); }
public override void Draw() { GUILayout.BeginArea(myRect, Title, Style); GUILayout.Space(5); GUILayout.BeginHorizontal(); GUILayout.Space(SpacePixel); GUILayout.FlexibleSpace(); GUILayout.BeginVertical(); GUILayout.Space(SpacePixel); //get all character var list = ObjectInfoHelper.GetCharacterNames(); //set character index if initialize request if (Initialize) { //find origin object var origin = AssetDatabase.LoadAssetAtPath(Path, typeof(GameObject)) as GameObject; if (origin != null) { //set index Index = list.IndexOf(list.Where(c => c == origin.name).FirstOrDefault()); } Initialize = false; } //choose character GUILayout.BeginHorizontal(); GUILayout.Label("Character", WhiteTxtStyle, GUILayout.Width(LabelWidth)); Index = EditorGUILayout.Popup(Index, list.ToArray()); GUILayout.EndHorizontal(); //find selected character string path = ValueManager.CharaPath + list[Index] + ".prefab"; var selected = AssetDatabase.LoadAssetAtPath(path, typeof(GameObject)) as GameObject; if (selected != null) { //set character path Path = path; } //is wait for character disappear GUILayout.BeginHorizontal(); GUILayout.Label("Is wait", WhiteTxtStyle, GUILayout.Width(LabelWidth)); IsWait = EditorGUILayout.Toggle(IsWait); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.Space(SpacePixel); GUILayout.EndHorizontal(); GUILayout.EndArea(); InPoint.Draw(); OutPoint.Draw(); base.Draw(); }
public override void Draw() { GUILayout.BeginArea(myRect, Title, Style); GUILayout.Space(5); GUILayout.BeginHorizontal(); GUILayout.Space(SpacePixel); GUILayout.FlexibleSpace(); GUILayout.BeginVertical(); GUILayout.Space(SpacePixel); //initialize if (Initialize) { //find origin object var origin = AssetDatabase.LoadAssetAtPath(path, typeof(AudioClip)) as AudioClip; if (origin != null) { //set background image myAudio = origin; } Initialize = false; } //Choose audio GUILayout.BeginHorizontal(); GUILayout.Label("Audio source", WhiteTxtStyle, GUILayout.Width(LabelWidth)); myAudio = EditorGUILayout.ObjectField(myAudio, typeof(AudioClip), false) as AudioClip; GUILayout.EndHorizontal(); //get audio path if (myAudio != null) { path = AssetDatabase.GetAssetPath(myAudio); } //audio volume GUILayout.BeginHorizontal(); GUILayout.Label("Volume", WhiteTxtStyle, GUILayout.Width(LabelWidth)); volume = EditorGUILayout.Slider(volume, 0, 1); GUILayout.EndHorizontal(); //music loop GUILayout.BeginHorizontal(); GUILayout.Label("Loop", WhiteTxtStyle, GUILayout.Width(LabelWidth)); loop = EditorGUILayout.Toggle(loop); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.Space(SpacePixel); GUILayout.EndHorizontal(); GUILayout.EndArea(); InPoint.Draw(); OutPoint.Draw(); base.Draw(); }
protected void OnClickRemoveNode() { InPoint.ClearPoint(); for (int i = 0; i < OutPoints.Count; i++) { OutPoints[i].ClearPoint(); } InPoint = null; OutPoints = null; m_onRemoveNode?.Invoke(this); }
public override void Draw() { GUILayout.BeginArea(myRect, Title, Style); GUILayout.Space(5); GUILayout.BeginHorizontal(); GUILayout.Space(SpacePixel); GUILayout.FlexibleSpace(); GUILayout.BeginVertical(); GUILayout.Space(SpacePixel); //character name GUILayout.BeginHorizontal(); GUILayout.Label("Name", WhiteTxtStyle, GUILayout.Width(LabelWidth)); CharaName = EditorGUILayout.TextField(CharaName); GUILayout.EndHorizontal(); //dialogue text box GUILayout.Label("Dialogue", WhiteTxtStyle); Dialog = EditorGUILayout.TextArea(Dialog, GUILayout.Height(50)); ShowCharParam = EditorGUILayout.Foldout(ShowCharParam, "Character", true); if (ShowCharParam) { GUILayout.BeginHorizontal(); GUILayout.Label("Font size", WhiteTxtStyle, GUILayout.Width(LabelWidth)); fontSize = EditorGUILayout.IntField(fontSize); GUILayout.EndHorizontal(); //dialogue text speed GUILayout.BeginHorizontal(); GUILayout.Label("Text speed", WhiteTxtStyle, GUILayout.Width(LabelWidth)); Speed = EditorGUILayout.IntSlider(Speed, 1, 5); GUILayout.EndHorizontal(); } //dialog show in one shot GUILayout.BeginHorizontal(); GUILayout.Label("No wait", WhiteTxtStyle, GUILayout.Width(LabelWidth)); NoWait = EditorGUILayout.Toggle(NoWait); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.Space(SpacePixel); GUILayout.EndHorizontal(); GUILayout.EndArea(); InPoint.Draw(); OutPoint.Draw(); base.Draw(); }
public void OnConnectUp(GameObject pObject) { setPoint(pObject); if (choosedInPoint && choosedOutPoint) { choosedOutPoint.connect(choosedInPoint); choosedInPoint.showLine(); } choosedInPoint = null; choosedOutPoint = null; choosedPointTransform = null; connectLine.visible = false; }
public void Draw() { InPoint.Draw(); OutPoint.Draw(); GUI.Box(NodeRect, Title, _style); EditorGUILayout.BeginVertical(); Rect currentContentRect = new Rect(NodeRect.x + 10, NodeRect.y + 30, NodeRect.width - 20, 20); DrawContent(ref currentContentRect); EditorGUILayout.EndVertical(); }
public void disconnect(InPoint pInPoint) { for (int i = 0; i < mConnectPoints.Count; ++i) { if (pInPoint == connectPoints[i]) { pInPoint.connectPoint = null; mConnectPoints.RemoveAt(i); connectPoints = mConnectPoints.ToArray(); return; } } Debug.LogError("disconnect(InPoint pInPoint)"); }
public override void Draw() { GUILayout.BeginArea(myRect, Title, Style); GUILayout.Space(5); GUILayout.BeginHorizontal(); GUILayout.Space(SpacePixel); GUILayout.FlexibleSpace(); GUILayout.BeginVertical(); GUILayout.Space(SpacePixel); GUILayout.Label("Branches", WhiteTxtStyle); for (int i = 0; i < brancheList.Count; i++) { myRect.height = DefaultRectHeight + 20 * i; GUILayout.BeginHorizontal(); GUILayout.Label(i + 1 + ".", WhiteTxtStyle, GUILayout.Width(30)); brancheList[i].Draw(); GUILayout.EndHorizontal(); } //add new branche(6 maximun) if (brancheList.Count < 6) { if (GUILayout.Button("+")) { brancheList.Add(CreateNewBranche(brancheList.Count)); } } //FontSize = EditorGUILayout.IntField("Font size:", FontSize); ////dialogue text box //GUILayout.Label("Dialogue"); //Dialogue = EditorGUILayout.TextArea(Dialogue, GUILayout.Height(50)); GUILayout.EndVertical(); GUILayout.Space(SpacePixel); GUILayout.EndHorizontal(); GUILayout.EndArea(); InPoint.Draw(); for (int i = 0; i < brancheList.Count; i++) { outPointList[i].Draw(-5, 32 + 21.5f * i); } base.Draw(); }
//------------------------------------------------------------------------/ // Methods: Public //------------------------------------------------------------------------/ /// <summary> /// Draws this node, as well as its connection points /// </summary> public void Draw(float scale) { GUI.Box(this.Rect, GUIContent.none, this.CurrentStyle); DrawContent(); if (InPoint.Enabled) { InPoint.Draw(scale); } if (OutPoint.Enabled) { OutPoint.Draw(scale); } //var center = this.Rect.center; //GUI.Label(new Rect(center, new Vector2(Rect.width, Rect.height)), Name); }
public override void Draw() { GUI.Box(NodeRect, NodeTitle, m_nodeStyle); InPoint.Draw(NodeRect); Rect _r = NodeRect; _r.height /= 2; for (int i = 0; i < OutPoints.Count; i++) { _r.y += i * (NodeRect.height / 2); OutPoints[i].Draw(_r); } _r = new Rect(NodeRect.position.x + 20, NodeRect.position.y + 20, NodeRect.width - 40, 15); ConditionType = (ConditionType)EditorGUI.EnumPopup(_r, ConditionType, m_popupStyle); }
public override void Draw() { GUILayout.BeginArea(myRect, Title, Style); GUILayout.Space(5); GUILayout.BeginHorizontal(); GUILayout.Space(SpacePixel); GUILayout.FlexibleSpace(); GUILayout.BeginVertical(); GUILayout.Space(SpacePixel); //find all story line in main game GameObject game = GameObject.FindGameObjectWithTag("dokidoki_vn_game"); var list = game.GetComponentsInChildren <StoryLine>().ToList(); //set story line index if initialize request if (Initialize) { //find origin object var origin = list.Where(s => s.name == Name).FirstOrDefault(); if (origin != null) { //set index Index = list.IndexOf(origin); } Initialize = false; } //get all story lines names var nameList = list.Select(s => s.gameObject.name).ToArray(); GUILayout.BeginHorizontal(); GUILayout.Label("Story line", WhiteTxtStyle, GUILayout.Width(LabelWidth)); Index = EditorGUILayout.Popup(Index, nameList); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.Space(SpacePixel); GUILayout.EndHorizontal(); GUILayout.EndArea(); InPoint.Draw(); OutPoint.Draw(); base.Draw(); }
public bool setPoint(GameObject pObject) { if (!pObject) return false; if (pObject.GetComponent<InPoint>()) choosedInPoint = pObject.GetComponent<InPoint>(); else if (pObject.GetComponent<OutPoint>()) choosedOutPoint = pObject.GetComponent<OutPoint>(); else return false; choosedPointTransform = pObject.transform; connectLine.visible = true; refreshLineShow(); return true; }
public override void Draw() { GUILayout.BeginArea(myRect, Title, Style); GUILayout.Space(5); GUILayout.BeginHorizontal(); GUILayout.Space(SpacePixel); GUILayout.FlexibleSpace(); GUILayout.BeginVertical(); GUILayout.Space(SpacePixel); //initialize if (Initialize) { //find origin object var origin = AssetDatabase.LoadAssetAtPath(path, typeof(SceneAsset)) as SceneAsset; if (origin != null) { //set Scene Scene = origin; } Initialize = false; } //Choose image GUILayout.BeginHorizontal(); GUILayout.Label("Scene", WhiteTxtStyle, GUILayout.Width(LabelWidth)); Scene = EditorGUILayout.ObjectField(Scene, typeof(SceneAsset), false) as SceneAsset; GUILayout.EndHorizontal(); if (Scene != null) { //get path path = AssetDatabase.GetAssetPath(Scene); } GUILayout.EndVertical(); GUILayout.Space(SpacePixel); GUILayout.EndHorizontal(); GUILayout.EndArea(); InPoint.Draw(); OutPoint.Draw(); base.Draw(); }
public override void Draw() { GUI.Box(NodeRect, NodeTitle, m_nodeStyle); InPoint.Draw(NodeRect); switch (m_part.Type) { case ConversationNodeType.Basic: DrawBasicNode(); break; case ConversationNodeType.MultipleChoices: DrawMultipleChoicesNode(); break; default: break; } }
void receiveSignal(InPoint sender, float value) { int lID = sender.pointId; if(value>=1f) { if(!lastOnOff[lID]) { lastOnOff[lID] = true; if (++signalCount == _inPoints.Length) outPoint.sendFull(); } } else if (lastOnOff[lID]) { lastOnOff[lID] = false; --signalCount; outPoint.sendNull(); } }
public override void Draw() { GUILayout.BeginArea(myRect, Title, Style); GUILayout.Space(5); GUILayout.BeginHorizontal(); GUILayout.Space(SpacePixel); GUILayout.FlexibleSpace(); GUILayout.BeginVertical(); GUILayout.Space(SpacePixel); //initialize if (Initialize) { //find origin object var origin = AssetDatabase.LoadAssetAtPath(Path, typeof(Sprite)) as Sprite; if (origin != null) { //set background image Image = origin; } Initialize = false; } //Choose image GUILayout.BeginHorizontal(); GUILayout.Label("Image", WhiteTxtStyle, GUILayout.Width(LabelWidth)); Image = EditorGUILayout.ObjectField(Image, typeof(Sprite), false) as Sprite; GUILayout.EndHorizontal(); //is wait for background appear GUILayout.BeginHorizontal(); GUILayout.Label("Is wait", WhiteTxtStyle, GUILayout.Width(LabelWidth)); IsWait = EditorGUILayout.Toggle(IsWait); GUILayout.EndHorizontal(); if (Image != null) { //get path Path = AssetDatabase.GetAssetPath(Image); //show preview GUILayout.Label(Image.texture, GUILayout.Width(200), GUILayout.Height(113)); if (myRect.height == DefaultRectHeight) { myRect.height = DefaultRectHeight + 110; } } else { //clear path Path = ""; if (myRect.height != DefaultRectHeight) { myRect.height = DefaultRectHeight; } } GUILayout.EndVertical(); GUILayout.Space(SpacePixel); GUILayout.EndHorizontal(); GUILayout.EndArea(); InPoint.Draw(); OutPoint.Draw(); base.Draw(); }
/// <summary> /// Draw the Node /// </summary> public virtual void Draw() { InPoint.Draw(NodeRect); OutPoints.ForEach(p => p.Draw(NodeRect)); GUI.Box(NodeRect, NodeTitle, m_nodeStyle); }
void receiveSignal(InPoint sender) { receiveSignal(sender, sender.powerValue); }
public override void Draw() { GUILayout.BeginArea(myRect, Title, Style); GUILayout.Space(5); GUILayout.BeginHorizontal(); GUILayout.Space(SpacePixel); GUILayout.FlexibleSpace(); GUILayout.BeginVertical(); GUILayout.Space(SpacePixel); //get all character var list = ObjectInfoHelper.GetCharacterNames(); //set character index if initialize request if (Initialize) { //find origin object var origin = AssetDatabase.LoadAssetAtPath(Path, typeof(GameObject)) as GameObject; if (origin != null) { //set index Index = list.IndexOf(list.Where(c => c == origin.name).FirstOrDefault()); } Initialize = false; } //choose character GUILayout.BeginHorizontal(); GUILayout.Label("Character", WhiteTxtStyle, GUILayout.Width(LabelWidth)); Index = EditorGUILayout.Popup(Index, list.ToArray()); GUILayout.EndHorizontal(); //find selected character string path = ValueManager.CharaPath + list[Index] + ".prefab"; var selected = AssetDatabase.LoadAssetAtPath(path, typeof(GameObject)) as GameObject; if (selected != null) { //set character path Path = path; //get all sprites name var spriteList = selected.GetComponentsInChildren <CharaSpriteSetting>().Select(s => s.name).ToArray(); //character sprite GUILayout.BeginHorizontal(); GUILayout.Label("Sprite", WhiteTxtStyle, GUILayout.Width(LabelWidth)); SpriteIndex = EditorGUILayout.Popup(SpriteIndex, spriteList); GUILayout.EndHorizontal(); //select character face if existe var faceList = selected.transform.GetChild(SpriteIndex).GetComponentInChildren <CharaFaceSetting>(). GetComponentsInChildren <Image>().Select(f => f.name).ToArray(); if (faceList.Length > 0) { //set face index to 0 if has face if (FaceIndex < 0) { FaceIndex = 0; } GUILayout.BeginHorizontal(); GUILayout.Label("Face", WhiteTxtStyle, GUILayout.Width(LabelWidth)); FaceIndex = EditorGUILayout.Popup(FaceIndex, faceList); GUILayout.EndHorizontal(); } else { //no face selected FaceIndex = -1; } } //character postion var charaPosList = Enum.GetValues(typeof(CharacterPosition)) .Cast <int>() .Select(x => Enum.GetName(typeof(CharacterPosition), x)) .ToArray(); GUILayout.BeginHorizontal(); GUILayout.Label("Position", WhiteTxtStyle, GUILayout.Width(LabelWidth)); CharaPos = (CharacterPosition)EditorGUILayout.Popup((int)CharaPos, charaPosList); GUILayout.EndHorizontal(); //custom position if (CharaPos == CharacterPosition.Custom) { if (myRect.height == DefaultRectHeight) { myRect.height = DefaultRectHeight + 20; } CustomPos = EditorGUILayout.Vector2Field("", CustomPos); } else { if (myRect.height != DefaultRectHeight) { myRect.height = DefaultRectHeight; } } //is wait for character appear GUILayout.BeginHorizontal(); GUILayout.Label("Is wait", WhiteTxtStyle, GUILayout.Width(LabelWidth)); IsWait = EditorGUILayout.Toggle(IsWait); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.Space(SpacePixel); GUILayout.EndHorizontal(); GUILayout.EndArea(); InPoint.Draw(); OutPoint.Draw(); base.Draw(); }
public override void Draw() { GUILayout.BeginArea(myRect, Title, Style); GUILayout.Space(5); GUILayout.BeginHorizontal(); GUILayout.Space(SpacePixel); GUILayout.FlexibleSpace(); GUILayout.BeginVertical(); GUILayout.Space(SpacePixel); //get all cg var list = ObjectInfoHelper.GetCGsName(); if (Initialize) { //find origin object var origin = AssetDatabase.LoadAssetAtPath(Path, typeof(Sprite)) as Sprite; if (origin != null) { //set index Index = list.IndexOf(list.Where(c => c == origin.name).FirstOrDefault()); } Initialize = false; } //selector for cg GUILayout.BeginHorizontal(); GUILayout.Label("CG", WhiteTxtStyle, GUILayout.Width(LabelWidth)); Index = EditorGUILayout.Popup(Index, list.ToArray()); GUILayout.EndHorizontal(); //set cg path Path = ValueManager.CGPath + list[Index] + ".jpg"; //is wait for CG appear GUILayout.BeginHorizontal(); GUILayout.Label("Is wait", WhiteTxtStyle, GUILayout.Width(LabelWidth)); IsWait = EditorGUILayout.Toggle(IsWait); GUILayout.EndHorizontal(); //GUILayout.BeginHorizontal(); //GUILayout.FlexibleSpace(); //load preview cg string path = ValueManager.CGPath + list[Index] + ".jpg"; var imgPriveiw = AssetDatabase.LoadAssetAtPath(path, typeof(Sprite)) as Sprite; if (imgPriveiw != null) { GUILayout.Label(imgPriveiw.texture, GUILayout.Width(200), GUILayout.Height(113)); } //GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.Space(SpacePixel); GUILayout.EndHorizontal(); GUILayout.EndArea(); InPoint.Draw(); OutPoint.Draw(); base.Draw(); }