public CToast(ref GraphicsDeviceManager graphicsDM, ref Feel feel, int xPos, int yPos, int width, int height, string text, string fontName, int fontSize, System.Drawing.FontStyle fontStyle, Color fontColor, Color backColor, TextAlign textAlign, bool isFocusable) : base(xPos, yPos, width, height, text, fontName, fontSize, fontStyle, fontColor, backColor, textAlign, isFocusable) { Trimmed = true; ShowMessage(text); }
/// <summary> /// Spawns a plane on a position /// </summary> /// <param name="location"></param> /// <param name="feel"></param> public void SpawnPlane(Vector2 location, Feel feel) { Land x = Instantiate(plane, new Vector3(location.x, location.y, 0), plane.transform.rotation) as Land; x.Spawn(location, feel); lands.Add(location, x); }
private ProjectDialogue_Template CreateTemplate(string line) { ProjectPhase _projectPhase = ProjectPhase.Decision; string _npcId = string.Empty; List <Dialogue> _dialogues = new List <Dialogue>(); string[] entries = line.Split(','); for (int i = 0; i < entries.Length; i++) { string entry = entries[i]; switch (entry) { case INST_SET_Id: _projectPhase = ConvertType.ConvertStringToProjectPhase(entries[++i]); break; case INST_SET_Npc: _npcId = entries[++i]; break; case INST_SET_Dia: string text = entries[++i]; Feel feel = ConvertType.CheckFeel(entries[++i]); _dialogues.Add(new Dialogue(text, feel)); break; } } return(new ProjectDialogue_Template(_projectPhase, _npcId, _dialogues)); }
static void Main(string[] args) { if (args.Length > 1 && args[0] == "--update") { CUpdateManager.Update(args[1]); } else { bool imFirstInstance; mutex = new Mutex(true, "F.E.E.L.", out imFirstInstance); if (!imFirstInstance) { return; } GC.KeepAlive(mutex); using (var feel = new Feel()) { var newVersion = (args.Length == 1 && args[0].Equals("--newversion")) || (args.Length == 2 && args[1].Equals("--newversion")) || (args.Length == 3 && args[2].Equals("--newversion")); feel.Main(newVersion); } } }
// Update is called once per frame void Update() { if (Input.GetKey(KeyCode.Return)) { inputField.gameObject.SetActive(false); if (inputField.text != "") { text.text = ""; replyPanel.SetActive(true); //判定 feel = Feel.Get(inputField.text); faceChanger.faceChange(feel); if (feel == 2) { RenderSettings.skybox = sunny; FileStr.InputStr(inputField.text); } else if (feel == 1) { RenderSettings.skybox = rain; rain2D.RainScript.RainIntensity = 0.5f; rain2D.RainScript.WindSoundVolumeModifier = 0.5f; } StartCoroutine(Chat()); inputField.text = ""; } topreturn.gameObject.SetActive(true); } }
public static void Init(Feel feel, int screenWidth, int screenHeight, bool drawRotated) { _feel = feel; _drawRotated = drawRotated; _screenWidth = screenWidth; _screenHeight = screenHeight; _rotationAngle = drawRotated ? MathHelper.PiOver2 : 0; }
void OnDestroy() { if (device == null) { return; } device.EndSession(); device.Disconnect(); device.Destroy(); device = null; }
// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) { Vector3 mouseLoc = Camera.main.ScreenToWorldPoint(Input.mousePosition); Vector2 planePosition = new Vector2(Mathf.Round(mouseLoc.x), Mathf.Round(mouseLoc.y)); if (Fieldmanager.instance.HasLandNear(planePosition)) { Fieldmanager.instance.SpawnPlane(planePosition, Feel.RandomFeel()); } } }
/// <summary> /// Spawns a land /// </summary> /// <param name="location"></param> /// <param name="feel"></param> public void Spawn(Vector2 location, Feel feel) { this.walls = new Walls(); this.feel = feel; // Decide to spawn loot SpawnLootIfShould(); // Decide to spawn enemy SpawnEnemyIfShould(); foreach (Material m in Fieldmanager.instance.planes) { if (m.name == feel.name) { this.GetComponent <Renderer>().material = m; break; } } // Set walls based on feel feel.GenerateWalls(); int walls = feel.blocked_sides; List <string> positions = new List <string>() { "top", "bottom", "left", "right" }; positions = positions.PickRandom(walls).ToList(); if (positions.Contains("top")) { PlaceWall(new Vector3(0, .45f, 0), true); this.walls.topBlocked = true; } if (positions.Contains("bottom")) { PlaceWall(new Vector3(0, -.45f, 0), true); this.walls.bottomBlocked = true; } if (positions.Contains("left")) { PlaceWall(new Vector3(-.45f, 0, 0)); this.walls.leftBlocked = true; } if (positions.Contains("right")) { PlaceWall(new Vector3(.45f, 0, 0)); this.walls.rightBlocked = true; } }
internal IEnumerator Chat() { // ChatAPIに送る情報を入力 WWWForm form = new WWWForm(); form.AddField("apikey", apikey); form.AddField("query", inputField.text, Encoding.UTF8); // 通信 using (UnityWebRequest request = UnityWebRequest.Post(url, form)) { yield return(request.SendWebRequest()); //Debug.Log(inputField.text); if (request.isNetworkError) { Debug.Log(request.error); } else { try { // 取得したものをJsonで整形 string itemJson = request.downloadHandler.text; JsonNode jsnode = JsonNode.Parse(itemJson); // Jsonから会話部分だけ抽出してTextに代入 if (text.text != null) { text.text += jsnode["results"][0]["reply"].Get <string>(); text.text += "。"; if (feel == 2) { text.text += "\nちゃんと覚えておきますね!"; } else if (feel == 1) { text.text += "\nぴえん。。。\n"; text.text += Feel.getMessage(); } } //Debug.Log(jsnode["results"][0]["reply"].Get<string>()); } catch (Exception e) { //エラーが出たらこれがログに吐き出される Debug.Log("JsonNode:" + e.Message); } } } }
public OBJScene(Feel game, int resX, int resY, bool rotateScreen) { // Create Sound Form topmostForm = new CSoundForm(); topmostForm.IsPlayEnded = false; // Create Devices feel = game; graphics = ((Feel)feel).GraphicsDM; spriteBatch = new SpriteBatch(graphics.GraphicsDevice); effectPost = feel.Content.Load <Effect>("Shader"); testTextFont = feel.Content.Load <SpriteFont>("arial10"); testTextPosition = new Vector2(5, 1); // set resolution ratio ChangeRes(resX, resY, rotateScreen, true); }
public static List <RomDesc> BuildListFromMameXML(Feel feel, OBJConfig objConfig, string emuCommandLine, string romPath) { var srcList = MameXMLReader.GetRomList(feel, objConfig.emulator_path, Application.StartupPath, objConfig.list_type, emuCommandLine, objConfig.mess_machine); var dstList = new List <RomDesc>(); if (srcList != null) { if (Directory.Exists(romPath)) { var fileList = Utils.GetFiles(romPath, objConfig.rom_extension); for (var iLoop = 0; iLoop < fileList.Length; iLoop++) { var romName = Path.GetFileNameWithoutExtension(fileList[iLoop]); var romFileName = Path.GetFileName(fileList[iLoop]); var romRelativePath = fileList[iLoop].Substring(romPath.Length + 1); // skip initial backslash romRelativePath = romRelativePath.Substring(0, romRelativePath.Length - romFileName.Length); var item = srcList.Find(c => c.Key.ToLower() == romName); if (item != null) { if (romRelativePath != string.Empty) { // remove trailing backslash if (romRelativePath.Substring(romRelativePath.Length - 1) == Path.DirectorySeparatorChar.ToString()) { romRelativePath = romRelativePath.Substring(0, romRelativePath.Length - 1); } item.RomRelativePath = romRelativePath; } dstList.Add(item); } if (iLoop % 100 == 0) { feel.ShowMessage("Adding available roms: " + Math.Floor((float)iLoop / (float)fileList.Length * 100.0f) + "%", true); } } feel.ShowToast("Done."); } else { feel.ShowMessage("\"" + romPath + "\" directory not found.\n\nPlease check " + objConfig.emulator_title + " \"rom_path\" parameter.", false); } } return(dstList); }
/// <summary> /// Log出力用メソッド /// 入力値を取得してLogに出力し、初期化 /// </summary> public void InputLogger() { string inputValue = inputField.text; if (inputValue.Length >= 2) { int pn = Feel.Get(inputValue); //if(pn==2)FileStr.InputStr(inputValue + "@" + pn); //Only Positive & Sentence if (pn == 2) { FileStr.InputStr(inputValue); } } // Debug.Log(inputValue); InitInputField(); }
private FavoriteItems_Template CreateTemplate(string line) { string id = string.Empty; Dictionary <String, DialogueFavoriteItem> itemLikeIdDictionary = new Dictionary <String, DialogueFavoriteItem>(); Dictionary <String, DialogueFavoriteItem> itemUnLikeIdDictionary = new Dictionary <String, DialogueFavoriteItem>(); Dictionary <String, DialogueFavoriteItem> itemExceptIdDictionary = new Dictionary <String, DialogueFavoriteItem>(); string[] entries = line.Split(','); for (int i = 0; i < entries.Length; i++) { string entry = entries[i]; switch (entry) { case INST_SET_ID: id = entries[++i]; break; case INST_SET_Like: string itemId = entries[++i]; string itemDialogue = entries[++i]; Feel itemFeel = ConvertType.CheckFeel(entries[++i]); itemLikeIdDictionary.Add(itemId, new DialogueFavoriteItem(itemId, itemDialogue, itemFeel)); break; case INST_SET_Unlike: string itemUnlikeId = entries[++i]; string itemUnlikeDialogue = entries[++i]; Feel itemUnlikeFeel = ConvertType.CheckFeel(entries[++i]); itemUnLikeIdDictionary.Add(itemUnlikeId, new DialogueFavoriteItem(itemUnlikeId, itemUnlikeDialogue, itemUnlikeFeel)); break; case INST_SET_Except: string itemExceptId = entries[++i]; string itemDialogueExceptId = entries[++i]; Feel itemExceptFeel = ConvertType.CheckFeel(entries[++i]); itemExceptIdDictionary.Add(itemExceptId, new DialogueFavoriteItem(itemExceptId, itemDialogueExceptId, itemExceptFeel)); break; } } return(new FavoriteItems_Template(id, itemLikeIdDictionary, itemUnLikeIdDictionary, itemExceptIdDictionary)); }
private void processTweet(string tweet) { try { dynamic json = JsonConvert.DeserializeObject(tweet); mapPoint point = new mapPoint(); point.coordinates = analizeCoordinates(json); if (point.coordinates != null) { Feel feelingType = analizeFeeling(json); if (feelingType != 0) { switch (feelingType) { case Feel.felicidad: point.color = "red"; break; case Feel.ascoEIra: point.color = "#4cff00"; break; case Feel.miedoOSorpresa: point.color = "yellow"; break; default: //tristeza point.color = "#03c7fc"; break; } pool.Add(point); } } else { tweetsSinCoordenadas++; } } catch (Exception e) { _logger.LogError(e.Message); } }
public static Feel CheckFeel(string text) { Feel temp = Feel.Normal; switch (text) { case INST_Feel_Normal: temp = Feel.Normal; break; case INST_Feel_Happiness: temp = Feel.Happiness; break; case INST_Feel_Sadness: temp = Feel.Sadness; break; case INST_Feel_Fear: temp = Feel.Fear; break; case INST_Feel_Disgust: temp = Feel.Disgust; break; case INST_Feel_Anger: temp = Feel.Anger; break; case INST_Feel_Surprise: temp = Feel.Surprise; break; } return(temp); }
/// <summary> /// Creates a new Video Player. Automatically creates the required Texture2D on the specificied GraphicsDevice. /// </summary> /// <param name="FileName">The video file to open</param> /// <param name="graphicsDevice">XNA Graphics Device</param> public XNAPlayer(Feel feel, string FileName, GraphicsDevice graphicsDevice, Action callback) { Utils.RunAsynchronously(() => { try { // Set video state currentState = VideoState.Stopped; // Store Filename filename = FileName; // Open DirectShow Interfaces InitInterfaces(); // Create a SampleGrabber Filter and add it to the FilterGraph SampleGrabber sg = new SampleGrabber(); ISampleGrabber sampleGrabber = (ISampleGrabber)sg; DsError.ThrowExceptionForHR(gb.AddFilter((IBaseFilter)sg, "Grabber")); // Setup Media type info for the SampleGrabber AMMediaType mt = new AMMediaType(); mt.majorType = MEDIATYPE_Video; // Video mt.subType = MEDIASUBTYPE_RGB24; // RGB24 mt.formatType = FORMAT_VideoInfo; // VideoInfo DsError.ThrowExceptionForHR(sampleGrabber.SetMediaType(mt)); // Construct the rest of the FilterGraph DsError.ThrowExceptionForHR(gb.RenderFile(filename, null)); // Set SampleGrabber Properties DsError.ThrowExceptionForHR(sampleGrabber.SetBufferSamples(true)); DsError.ThrowExceptionForHR(sampleGrabber.SetOneShot(false)); DsError.ThrowExceptionForHR(sampleGrabber.SetCallback((ISampleGrabberCB)this, 1)); // Hide Default Video Window IVideoWindow pVideoWindow = (IVideoWindow)gb; DsError.ThrowExceptionForHR(pVideoWindow.put_MessageDrain(IntPtr.Zero)); DsError.ThrowExceptionForHR(pVideoWindow.put_WindowState(WindowState.Hide)); DsError.ThrowExceptionForHR(pVideoWindow.put_AutoShow(OABool.False)); // Create AMMediaType to capture video information AMMediaType MediaType = new AMMediaType(); DsError.ThrowExceptionForHR(sampleGrabber.GetConnectedMediaType(MediaType)); VideoInfoHeader pVideoHeader = new VideoInfoHeader(); Marshal.PtrToStructure(MediaType.formatPtr, pVideoHeader); // Store video information videoHeight = pVideoHeader.BmiHeader.Height; videoWidth = pVideoHeader.BmiHeader.Width; avgTimePerFrame = pVideoHeader.AvgTimePerFrame; bitRate = pVideoHeader.BitRate; DsError.ThrowExceptionForHR(ms.GetDuration(out videoDuration)); // Create byte arrays to hold video data videoFrameBytes = new byte[(videoHeight * videoWidth) * 4]; // RGBA format (4 bytes per pixel) bgrData = new byte[(videoHeight * videoWidth) * 4]; // BGR24 format (3 bytes per pixel + 1 for safety) // Create Output Frame Texture2D with the height and width of the video outputFrame = new Texture2D(graphicsDevice, videoWidth, videoHeight, 1, TextureUsage.None, SurfaceFormat.Color); feel.RunOnUIThread(callback); } catch { feel.ShowToast("Unable to Load or Play the video file"); } }, () => { }); }
void Awake() { device = new Feel(deviceKind); device.Connect(deviceName); }
public bool PlayVideo(Feel feel, string fileNameWithoutExt, string parentFilenameWithoutExt, int width, int height, int xPos, int yPos, int volume, float speed, Action callback) { if (_fileName == fileNameWithoutExt || _fileName == parentFilenameWithoutExt) { return(false); } _width = width; _height = height; _xPos = xPos; _yPos = yPos; _isPlaying = false; Dispose(); var fileName = string.Empty; for (var iLoop = 0; iLoop < 2; iLoop++) { switch (iLoop) { case 0: _fileName = fileNameWithoutExt; break; case 1: _fileName = parentFilenameWithoutExt; break; } if (File.Exists(_fileName + ".avi")) { fileName = _fileName + ".avi"; break; } else if (File.Exists(_fileName + ".mp4")) { fileName = _fileName + ".mp4"; break; } } if (fileName != string.Empty) { _dxPlay = new XNAPlayer(feel, fileName, _graphicsDM.GraphicsDevice, () => { if (_dxPlay != null) { _dxPlay.OnVideoComplete += new EventHandler(videoPlayer_OnVideoComplete); if (speed != 1) { _dxPlay.SetSpeed(speed); } SetVolume(volume); Play(); callback(); } } ); return(true); } return(false); }
public CVideo(ref GraphicsDeviceManager graphicsDM, ref Feel feel) { _graphicsDM = graphicsDM; _feel = feel; }
public Dialogue(string text, Feel feel) { this.text = text; this.feel = feel; }
public CMenuManager(ref GraphicsDeviceManager graphicsDM, ref Feel game) { graphics = graphicsDM; feel = game; menu = new CMenu(); }
public static List <RomDesc> ProcessMessRomList(Feel feel, List <RomDesc> romList, string emuPath, string feelPath, feel.ListType listType, string emuCommandLine, string machine) { var xmlFile = emuPath + Path.DirectorySeparatorChar + "mess_sw.xml"; var reader = new XmlTextReader(xmlFile); var exitMessage = string.Empty; if (!File.Exists(xmlFile)) { exitMessage = MameXMLReader.CreateMameXML(emuPath, feelPath, listType, emuCommandLine); } if (exitMessage == string.Empty) { if (!File.Exists(xmlFile)) { exitMessage = "mess_sw.xml not found.\n\nPlease check mess_sw.xml generation."; } else { var mameBuild = ""; var counter = 0; while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: var isRightMachine = false; switch (reader.Name) { case "softwarelist": while (reader.MoveToNextAttribute()) { switch (reader.Name) { case "name": if (reader.Value == machine) { isRightMachine = true; } break; } } break; case "software": var rom = ReadRom(reader, mameBuild); if (rom != null) { if (++counter % 100 == 0) { feel.ShowMessage("Parsing available roms: " + counter + " roms...", true); } romList.Add(rom); } break; } if (!isRightMachine) { continue; } break; } } } } if (exitMessage != string.Empty) { feel.ShowMessage(exitMessage, false); return(null); } return(romList); }
public static List <RomDesc> GetRomList(Feel feel, string emuPath, string feelPath, feel.ListType listType, string emuCommandLine, string machine) { var xmlFile = emuPath + Path.DirectorySeparatorChar + "mame.xml"; var infoFile = emuPath + Path.DirectorySeparatorChar + "mame.info"; var catverFile = emuPath + Path.DirectorySeparatorChar + "catver.ini"; var romList = new List <RomDesc>(); var reader = new XmlTextReader(xmlFile); var exitMessage = string.Empty; if ((listType == ListType.mame_xml_list && !File.Exists(xmlFile)) || (listType == ListType.mame_listinfo && !File.Exists(infoFile)) || (listType == ListType.mess_machine && !File.Exists(xmlFile))) { feel.ShowMessage("Creating " + xmlFile + "...", true); // in mess-mode, process as mame_xml_list exitMessage = MameXMLReader.CreateMameXML(emuPath, feelPath, listType == ListType.mess_machine ? ListType.mame_xml_list : listType, emuCommandLine); } if (exitMessage == string.Empty) { if (!File.Exists(xmlFile)) { exitMessage = xmlFile + " not found.\n\nPlease check mame.xml / mame.info generation."; } else { try { var mameBuild = ""; var counter = 0; while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: switch (reader.Name) { case "mame": while (reader.MoveToNextAttribute()) { switch (reader.Name) { case "build": mameBuild = reader.Value.Split(' ')[0]; // normalize version names like 0.106u1 .. 9 to 0.106u01 // to grant proper alpha comparison if (mameBuild.LastIndexOf("u") == mameBuild.Length - 2) { mameBuild = mameBuild.Substring(0, mameBuild.LastIndexOf("u") + 1) + "0" + mameBuild.Substring(mameBuild.LastIndexOf("u") + 1); } break; } } break; case "game": case "machine": var rom = ReadRom(reader, mameBuild); if (rom != null) { if (listType == ListType.mess_machine && rom.Key == machine) { ProcessMessRomList(feel, romList, emuPath, feelPath, listType, emuCommandLine, machine); } else if (listType != ListType.mess_machine) { if (++counter % 100 == 0) { feel.ShowMessage("Parsing available roms: " + counter + " roms...", true); } romList.Add(rom); } } break; } break; } } } catch { exitMessage = "Error parsing mame.xml file"; } finally { reader.Close(); } } } if (exitMessage == string.Empty && File.Exists(catverFile) && listType != ListType.mess_machine) { var catverList = new List <Catver>(); var file = File.OpenText(catverFile); var listCounter = 0f; while (!file.EndOfStream) { var line = file.ReadLine().Trim().ToString(); if (line.ToLower() == "[veradded]") { break; } if (line != "" && !line.StartsWith("[") && line.Contains("=")) { if (++listCounter % 100 == 0) { feel.ShowMessage("Parsing catver.ini entries: " + listCounter + " roms...", true); } var split = line.IndexOf('='); if (split > 0) { var catver = new Catver(); catver.Name = line.Substring(0, split); catver.Category = line.Substring(split + 1); catverList.Add(catver); } } } file.Close(); var updateCounter = 0f; foreach (var cat in catverList) { if (++updateCounter % 100 == 0) { feel.ShowMessage("Updating roms category: " + Math.Floor(updateCounter / listCounter * 100.0f) + "%", true); } var items = romList.FindAll(c => (c.Key == cat.Name || c.CloneOf == cat.Name)); foreach (var item in items) { if (item.Category == "") { item.Category = cat.Category; } } } } if (exitMessage != string.Empty) { if ((listType == ListType.mame_xml_list || listType == ListType.mess_machine) && File.Exists(xmlFile)) { exitMessage += "\nCorrupted mame.xml file: please re-run build."; File.Delete(xmlFile); } if (listType == ListType.mame_listinfo && File.Exists(infoFile)) { exitMessage += "\nCorrupted mame.info file: please re-run build."; File.Delete(infoFile); } feel.ShowMessage(exitMessage, false); return(null); } return(romList); }