private void placeObject(StoryObject storyObject) { var ray = ARCamera.ScreenPointToRay(screenPosition); Debug.DrawRay(ray.origin, ray.direction * 10000, Color.yellow); RaycastHit hit; if (Physics.Raycast(ray, out hit, Mathf.Infinity)) { var spawnedObject = Instantiate(storyObject.prefab, hit.point, hit.collider.transform.rotation); spawnedObject.AddComponent(typeof(StoryNodeController)); spawnedObject.GetComponent <StoryNodeController>().storyNode.title = storyObject.name; if (storyObject.overheadUIOffset != 0.0f) { spawnedObject.GetComponent <StoryNodeController>().overheadUIOffset = storyObject.overheadUIOffset; } var s = .25f; spawnedObject.transform.localScale = new Vector3(s, s, s); placedStoryObjects.Add(spawnedObject); toggleStoryNodeDetail(true, spawnedObject); if (onPlacedObject != null) { onPlacedObject(); } } }
public int DeleteInformation(StoryObject storyObj) { SqlConnection con = GetConnection(); con.Open(); SqlCommand cmd = new SqlCommand("Delete_Story", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@StoryId", storyObj.StoryId); cmd.Parameters.AddWithValue("@UserId", storyObj.UserId); try { return(cmd.ExecuteNonQuery()); } catch { throw; } finally { cmd.Dispose(); con.Close(); con.Dispose(); } }
//private void ShowSeperator() //{ // GUILayout.BeginVertical(); // int count = (int)(position.height / 20); // //Debug.Log(count); // for (int i = 0; i < count; i++) // { // //GUILayout.Label("★"); // EditorGUILayout.LabelField("★"); // } // GUILayout.EndVertical(); //} private void StoryValue() { StoryObject story = Selection.activeObject as StoryObject; if (story == null) { EditorGUILayout.LabelField("Not select story!", GUILayout.Width(300)); return; } if (story._Story != null) { EditorGUILayout.BeginVertical(GUI.skin.box, GUILayout.Width(300)); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("<color=#FF00FF>" + story.name + "</color>", ResourcesManager.GetInstance.GetFontStyle(18)); if (GUILayout.Button("<color=#00FF00>Add Value</color>", ResourcesManager.GetInstance.skin.button, GUILayout.Height(25))) { ValueAdder.Open(story._Story); } EditorGUILayout.EndHorizontal(); GUILayout.Space(10); ShowContainer(story._Story); EditorGUILayout.EndVertical(); } }
private void CreateNewStory() { string path = EditorUtility.SaveFilePanelInProject("Create Story", "New Story", "asset", "Create new story"); if (!string.IsNullOrEmpty(path)) { StoryObject o = ScriptableObject.CreateInstance <StoryObject>();// new CryStory.Runtime.StoryObject(); AssetDatabase.CreateAsset(o, path); Selection.activeObject = o; } }
public override void Init() { currentStoryIndex = 0; characters = new Dictionary <string, Character>(); canContinueStory = true; storyTimer = new Stopwatch(); textPen = new Pen(Color.White); outlineBox = new Rectangle(20, (int)(Settings.SCREEN_HEIGHT * 0.8), (Settings.SCREEN_WIDTH - 40), (int)(Settings.SCREEN_HEIGHT * 0.2 - 20)); textBox = new Rectangle(40, (int)(Settings.SCREEN_HEIGHT * 0.8 + 20), (Settings.SCREEN_WIDTH - 80), (int)(Settings.SCREEN_HEIGHT * 0.2 - 40)); currentStory = fullStory[currentStoryIndex]; runStoryElements(); }
protected void btn_update_Click(object sender, EventArgs e) { int id = int.Parse(Session["story_id"].ToString()); StoryObject storyobj = new StoryObject(); storyobj.StoryId = id; storyobj.StoryTitle = tbxStoryTitle.Text; storyobj.StoryDetail = tbxStoryDetail.Text; DateTime localDateTime, univDateTime; localDateTime = DateTime.Now; univDateTime = localDateTime.ToUniversalTime(); storyobj.UpdateDate = univDateTime; if (ddlStoryStatus.Visible == true) { if (ddlStoryStatus.SelectedValue == "1") { storyobj.Status = true; } else if (ddlStoryStatus.SelectedValue == "0") { storyobj.Status = false; } } else { storyobj.Status = false; } try { int result = dal.UpdateInformation(storyobj); if (result == 1) { SuccessPanel_story.Visible = true; //Response.Redirect("/Control_Panel/story.aspx"); } else { DangerPanel.Visible = true; } } catch { throw; } }
public bool OnGUI(StoryEditorWindow window) { //if (!Selection.activeObject) { ShowTips(window._windowRect.center); return true; } StoryObject story = Selection.activeObject as StoryObject; window._storyObject = story; if (story == null) { ShowTips(window._windowRect.center); return(true); } return(false); }
protected void btn_save_Click(object sender, EventArgs e) { StoryObject storyobj = new StoryObject(); storyobj.StoryTitle = tbxStoryTitle.Text; storyobj.StoryDetail = tbxStoryDetail.Text; storyobj.UserId = Int32.Parse(Session["user_id"].ToString()); if (ddlStoryStatus.Visible == true) { if (ddlStoryStatus.SelectedValue == "1") { storyobj.Status = true; } else if (ddlStoryStatus.SelectedValue == "0") { storyobj.Status = false; } } else { storyobj.Status = false; } try { int result = dal.InsertInformation(storyobj); if (result == 1) { LoadAllStory(); LoadAllStoryPhoto(); LoadStoryTitle(); SuccessPanel_story.Visible = true; tbxStoryTitle.Text = ""; tbxStoryDetail.Text = ""; } else { DangerPanel.Visible = true; tbxStoryTitle.Text = ""; tbxStoryDetail.Text = ""; } } catch { throw; } }
public static StoryObject LoadStory(string storyName, string packageToLoad) { UnloadAssetBundle(); Debug.Log(CombinePaths(Application.streamingAssetsPath, storyName, currentLanguage.ToLower() + "_" + packageToLoad.ToString())); ///Debug.Log("Story loaded"); SceneRefCounter = 0; myLoadedAssetBundle = AssetBundle.LoadFromFile(CombinePaths(Application.streamingAssetsPath, storyName, currentLanguage.ToLower() + "_" + packageToLoad.ToString())); /*#if UNITY_IPHONE * myLoadedAssetBundle = AssetBundle.LoadFromFile(CombinePaths(Application.streamingAssetsPath, storyName, currentLanguage.ToLower() + "_" + packageToLoad.ToString())); #endif #if UNITY_ANDROID * myLoadedAssetBundle = AssetBundle.LoadFromFile(CombinePaths(Application.streamingAssetsPath, storyName, currentLanguage.ToLower() + "_" + packageToLoad.ToString())); #endif*/ CurrentAssetPackage = packageToLoad.ToString(); //AssetStreamingCounter++; //Debug.Log (CombinePaths(Application.streamingAssetsPath, storyName, currentLanguage.ToLower() + "_" + packageToLoad.ToString())); if (myLoadedAssetBundle == null) { //Debug.LogErrorFormat("Failed to load {0} assetbundle from story {1}", currentLanguage.ToLower(), storyName); return(null); } StoryObject story = new StoryObject(); string[] files = myLoadedAssetBundle.GetAllAssetNames(); foreach (string file in files) { AddFileToStory(story, file); //Debug.Log (story+"//"+ file); } UnloadAssetBundle(); currentStory = story; return(currentStory); }
public void ChangeCurrentStory() { float Chance; Chance = Mathf.Floor(Random.Range(1, 100)); if (Chance < 91) { CurrentEvent = RandomAttack.stories[0]; CurrentDialog = CurrentEvent.eventdialog[0]; } else { CurrentEvent = MainStory.stories[0]; CurrentDialog = CurrentEvent.eventdialog[0]; } UpdateDialogBox(); }
private void loadStoryPanel() { PanelStoryies.Controls.Clear(); PanelStoryies.Refresh(); int top = PanelStoryies.Top; foreach (Story item in db.Story.ToList()) { var storyItem = new StoryObject(item, PanelStoryies); storyItem.NSPanel = PanelNotStarted; storyItem.IPPanel = PanelInProgress; storyItem.DPanel = PanelDone; storyItem.Top = top; Mb btn = new Mb(); btn.StoryId = item.Id; btn.Text = "Add.."; btn.Visible = true; btn.Top = top; btn.Left = storyItem.Right; btn.Width = 60; btn.Height = 50; btn.Click += new EventHandler(addDraft); PanelStoryies.Controls.Add(btn); Mb btnDelete = new Mb(); btnDelete.StoryId = item.Id; btnDelete.Text = "Delete.."; btnDelete.Visible = true; btnDelete.Top = top + 50; btnDelete.Left = storyItem.Right; btnDelete.Width = 60; btnDelete.Height = 50; btnDelete.Click += new EventHandler(deleteStory); PanelStoryies.Controls.Add(btnDelete); top += 110; } }
public void TellStory() { if (storyTimer.ElapsedMilliseconds > 100) { canContinueStory = true; storyTimer.Reset(); } if (canContinueStory) { if (currentStoryIndex < fullStory.Count - 1) { currentStoryIndex++; currentStory = fullStory[currentStoryIndex]; runStoryElements(); canContinueStory = false; } else { Debug.WriteLine("STORY OVER"); } } }
public override void OnInspectorGUI() { TweenEvent baseEvent = (TweenEvent)target; if (StoryNameManager.instance == null) { GUILayout.Label("No StoryNameManager Singleton found in scene"); return; } if (story == null) { story = DataManager.LoadStory(StoryNameManager.instance.storyName, "0"); } if (story == null) { Debug.LogErrorFormat("Story with the name {0} could not be loaded!", DataManager.currentStoryName); return; } //We get the index based on the name int index = 0; for (int i = 0; i < story.pageObjects.Count; i++) { if (baseEvent.pageName == story.pageObjects[i].name) { index = i; break; } } string[] pageNames = story.GetPageNames(); index = EditorGUILayout.Popup("Page", index, pageNames); baseEvent.pageName = pageNames[index]; PageObject page = story.GetPage(baseEvent.pageName); //We get the index based on the name index = 0; for (int i = 0; i < page.audioObjects.Count; i++) { if (baseEvent.audioName == page.audioObjects[i].name) { index = i; break; } } string[] audioNames = page.GetAudioNames(); index = EditorGUILayout.Popup("Audio", index, audioNames); baseEvent.audioName = audioNames[index]; //This is quite hacky. Every event is a DOTweenAnimation, but things like ActivationEvents simple don't show that. if (baseEvent.GetType() == typeof(TweenEvent)) { base.OnInspectorGUI(); } }
public void NewGameStory() { CurrentEvent = MainStory.stories[0]; CurrentDialog = CurrentEvent.eventdialog[0]; UpdateDialogBox(); }
void OnEnable() { storyObject = (StoryObject)target; }
public void addStoryObject(StoryObject storyObject) { storyline.Enqueue(storyObject); }
private static void AddFileToStory(StoryObject story, string file) { int pathDepth = 2; string[] splitPath = file.Split('/'); for (int i = 0; i < splitPath.Length; i++) { //Debug.Log (splitPath[i]); if (splitPath[i] == currentStoryName) { if (i + pathDepth + 2 >= splitPath.Length) { Debug.LogWarningFormat("Can't add file to story {0}", file); return; } string pageName = splitPath[i + pathDepth + 1]; //Get the page from the story PageObject page = story.GetPage(pageName); //Debug.Log (pageName); //page = null; //If the page wasn't in the story yet, create a new object if (page == null) { page = new PageObject() { name = pageName }; story.pageObjects.Add(page); } //Get the audio from the page. The name is actually the foldername, not the file name of the audio string audioName = splitPath[i + pathDepth + 2]; //If the audio doesn't exist, craete a new one AudioObject audioObj = page.GetAudio(audioName); if (audioObj == null) { audioObj = new AudioObject() { name = audioName }; page.audioObjects.Add(audioObj); } Object fileObj = myLoadedAssetBundle.LoadAsset(file); AudioClip clip = fileObj as AudioClip; if (clip != null) { audioObj.clip = clip; return; } TextAsset txt = fileObj as TextAsset; if (txt != null) { //SceneRef[SceneRefCounter] = audioName; //Debug.Log (SceneRef[SceneRefCounter]); //SceneRefCounter ++; //Debug.Log (txt.text); audioObj.sentence = GetSentence(txt.text); return; } Debug.LogErrorFormat("File of type {0} detected inside the AssetBundle. It only supports AudioClips and TextAssets!", fileObj.GetType()); return; } } Debug.Log("Done"); }