public Block(Resources.BlockRegistry.BlockTypes type,Block[,] grid,short x,short y) { this.Type = type; Grid = grid; X = x; Y = y; }
public void create(float splitRate, float attackPotency, float decayRate, int faction, float mutationRate, //Transform parentGroup, Vector2 move, float speed, Resources res, bool splitting) { //this.transform.parent=parentGroup; this.res=res; this.speed=speed; this.move=move; this.splitRate = splitRate; this.attackPotency = attackPotency; this.decayRate = decayRate; this.mutationRate=mutationRate; splitTime = 1; started = true; attributes=gameObject.GetComponent<MAttributes>(); attributes.faction = faction; this.splitting=splitting; }
public static void Initialize(Resources resources) { const string sectionName = UrlsConfiguration.SectionName; var routingConfiguration = ConfigurationServices.ConfigurationSource.GetSection(sectionName) as UrlsConfiguration; Verify.IsNotNull(routingConfiguration, "Config section '{0}' is missing", sectionName); var factory = new UrlFormatterFactory(); var formatters = new List<Tuple<IUrlFormatter, bool>>(); var urlFormattersConfigNode = routingConfiguration.UrlFormatters; if (urlFormattersConfigNode != null) { foreach (var urlFormatterData in urlFormattersConfigNode) { string name = urlFormatterData.Name; try { formatters.Add(new Tuple<IUrlFormatter, bool>(factory.Create(name), urlFormatterData.Mandatory)); } catch(Exception ex) { Log.LogError(LogTitle, "Failed to load url formatter '{0}'", name); Log.LogError(LogTitle, ex); } } } resources.UrlFormatters = formatters; }
public Terrain(Backend backend, TerrainData data, int chunks, int resolution, Resources.Material material, Resources.Material compositeMaterial) { if (backend == null) throw new ArgumentNullException("backend"); if (data == null) throw new ArgumentNullException("data"); Backend = backend; Data = data; var chunkSize = new Vector2(data.WorldSize.X, data.WorldSize.Z) / (float)chunks; // Setup the chunks for (var y = 0; y < chunks; y++) { for (var x = 0; x < chunks; x++) { var chunkPosition = new Vector2(chunkSize.X * x, chunkSize.Y * y); var chunk = new Chunk(this, chunkPosition, chunkSize, resolution, chunks); // TODO: Setup correct materials per chunk so that we can have different splatmaps etc ... chunk.Mesh.Material = material; chunk.SplatMaterial = material; chunk.CompositeMaterial = compositeMaterial; Chunks.Add(chunk); } } Mesh = new Resources.Mesh("terrain", ""); Mesh.SubMeshes = Chunks.Select(c => c.Mesh).ToArray(); Mesh.State = Common.ResourceLoadingState.Loaded; }
public GameObject SummonObject(Object toSummon, Vector3 location, bool takeResource = true) { if (GetComponentInChildren<Ghost>() != null) { return null; } GameObject summonedObject = Instantiate(toSummon, location, Quaternion.identity) as GameObject; summonedObject.transform.parent = transform; summonedObject.GetComponent<BasicObject>().Parent = GetComponent<Player>(); summonedObject.GetComponentInChildren<SkinnedMeshRenderer>().enabled = false; if (takeResource) { if (summonedObject.GetComponent<BasicObject>().Cost > OwnedResources) { Destroy(summonedObject); return null; //TODO add feedback to show that player cannot afford } else { if (summonedObject.GetComponent<Building>() == null || !PlayerInfo.IsHuman) { OwnedResources -= summonedObject.GetComponent<BasicObject>().Cost; summonedObject.GetComponent<SkinnedMeshRenderer>().enabled = true; return summonedObject; } else { summonedObject.AddComponent<Ghost>(); return summonedObject; } } } else { summonedObject.GetComponentInChildren<SkinnedMeshRenderer>().enabled = true; return summonedObject; } }
public override IAudioBuffer InitAudioBuffer(Resources.Resource handle) { var bufferId = AL.GenBuffer(); var sourceId = AL.GenSource(); var reader = new AudioReader(handle.Stream); //Read var soundData = reader.ReadToEnd(); AL.BufferData(bufferId, soundData); var error = AL.GetError(); if (error != ALError.NoError) { Logger.Error("Could not read Audio, {0}", error); return null; } var audioBuffer = new OpenAlAudioBuffer(bufferId,sourceId,soundData.Data.Length, handle); //Prepare AL.Source(sourceId, ALSourcei.Buffer, (int)bufferId); //Add AllSamples.Add(audioBuffer); return audioBuffer; }
void Start() { zasoby = gameObject.GetComponent<Resources>(); zasoby.like = 0; zasoby.tweet = 0; zasoby.snap = 0; }
public static void DoInitializeResources(Resources resources) { if (HasConfiguration()) { resources.HookRegistratorPluginNames = new List<string>(); IConfigurationSource configurationSource = GetConfiguration(); var settings = configurationSource.GetSection(HookRegistratorSettings.SectionName) as HookRegistratorSettings; if (settings == null) { throw new ConfigurationErrorsException(string.Format("Failed to load the configuration section '{0}' from the configuration", HookRegistratorSettings.SectionName)); } foreach (HookRegistratorData data in settings.HookRegistratorPlugins) { resources.HookRegistratorPluginNames.Add(data.Name); } } else { resources.HookRegistratorPluginNames = new List<string>(); } }
public Drawable GetIconDrawable(Resources res, PwDatabase db, PwIcon icon, PwUuid customIconId) { if (!customIconId.Equals(PwUuid.Zero)) { return GetIconDrawable (res, db, customIconId); } return GetIconDrawable (res, icon); }
public Ship(Resources resources, int id, double maxVelocity, double maxAcceleration, double angularVelocity) : base(BitmapDrawable.Create(resources, id)) { Velocity.Max = maxVelocity; MaxAcceleration = maxAcceleration; AngularVelocity = angularVelocity; }
public override void Awake() { base.Awake(); Cost = new Resources { Stone = 50 }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Suit); Type = Intent.GetIntExtra("SuitType", -1); Res = this.Resources; switch (Type) { case 1: LoadHighArkan(); break; case 2: LoadCupSuit(); break; case 3: LoadSwordSuit(); break; case 4: LoadPentacle(); break; case 5: LoadStaff(); break; default: break; } }
/// <summary> /// Initialise the browser. /// </summary> /// <param name="view"></param> public ViewBrowser(Resources.View view) { View = view; InitializeComponent(); foreach (var group in view.Groups) { string label = group.Index + ". Animation " + group.Animation.Index + (group.IsMirrored ? " (mirrored)" : ""); groupsView.Items.Add(new ListViewItem(label)); } foreach (var animation in view.Animations) { string label = animation.Index + ". " + animation.Unknowns.ToCommaSeparatedList() + " " + animation.Cells.Count + " frame" + (animation.Cells.Count == 1 ? "" : "s"); animationsView.Items.Add(new ListViewItem(label)); } Size smallImageSize = Size.Empty, largeImageSize = Size.Empty; foreach (ViewCell cell in view.Cells) { smallImageSize.Width = Math.Max(smallImageSize.Width, cell.Raster.Image.Width); smallImageSize.Height = Math.Max(smallImageSize.Height, cell.Raster.Image.Height); largeImageSize.Width = Math.Max(largeImageSize.Width, cell.Raster.Image4x.Width); largeImageSize.Height = Math.Max(largeImageSize.Height, cell.Raster.Image4x.Height); } foreach (ViewCell cell in view.Cells) { string label = cell.Index + ". "; if (cell.Offset != Vector2i.Zero) label += "offset " + cell.Offset.X + "x" + cell.Offset.Y + ", "; label += "size " + cell.Raster.Width + "x" + cell.Raster.Height; cellsView.Controls.Add(new ViewBrowserItem(label, cell.Raster.Image4x)); //cellsView.Items.Add(new ListViewItem(label, cell.Index)); } }
public StaticImage(Resources resources, int id) { mBitmap = BitmapDrawable.Create(resources, id); ShouldBeEjected = false; DrawThread.StaticLayer.Add(this); }
public ActionResult Article(int id) { Resources pt = new Resources(); MySqlConnection myConn; MySqlDataReader dataReader; myConn = new MySqlConnection(TaqtiController.connectionString); myConn.Open(); MySqlCommand cmd = new MySqlCommand(TaqtiController.connectionString); cmd = myConn.CreateCommand(); cmd.CommandText = "select * from Resources where id = @id;"; cmd.Parameters.AddWithValue("@id",id); dataReader = cmd.ExecuteReader(); while (dataReader.Read()) { pt.id = dataReader.GetInt32(0); pt.title = dataReader.GetString(1); pt.text = dataReader.GetString(2); pt.author = dataReader.GetString(3); pt.date = dataReader.GetDateTime(4); pt.category = dataReader.GetString(5); pt.website = dataReader.GetString(6); pt.keywords = dataReader.GetString(7); } myConn.Close(); return View(pt); }
// // GET: /Resources/ public ActionResult Index() { List<Resources> pt = new List<Resources>(); MySqlConnection myConn; MySqlDataReader dataReader; myConn = new MySqlConnection(TaqtiController.connectionString); myConn.Open(); MySqlCommand cmd = new MySqlCommand(TaqtiController.connectionString); cmd = myConn.CreateCommand(); cmd.CommandText = "select * from Resources order by date DESC"; dataReader = cmd.ExecuteReader(); while (dataReader.Read()) { Resources p = new Resources(); p.id = dataReader.GetInt32(0); p.title = dataReader.GetString(1); p.text = dataReader.GetString(2); p.author = dataReader.GetString(3); p.date = dataReader.GetDateTime(4); p.category = dataReader.GetString(5); p.website = dataReader.GetString(6); pt.Add(p); } myConn.Close(); return View(pt); }
private void ComputeRotationOffset(Resources.CornersBox corners) { var angle = transform.rotation.eulerAngles.z; Resources.ReverseRotatePositionVector(ref corners._bottomLeft, angle); Resources.ReverseRotatePositionVector(ref corners._bottomRight, angle); Resources.ReverseRotatePositionVector(ref corners._topLeft, angle); Resources.ReverseRotatePositionVector(ref corners._topRight, angle); }
public static void PadActionBar(this Toolbar toolbar, Resources resources) { var resourceId = resources.GetIdentifier("status_bar_height", "dimen", "android"); var height = resourceId > 0 ? resources.GetDimensionPixelSize(resourceId) : 0; toolbar.SetPadding(0, height / 2, 0, 0); }
private Bitmap img; // The object bitmap #endregion Fields #region Constructors public DragObject(Resources res, int drawableIntID) { BitmapFactory.Options options = new BitmapFactory.Options(); options.InJustDecodeBounds = true; img = BitmapFactory.DecodeResource(res, drawableIntID); id = count; count++; }
public AsyncDrawable(Resources res, Bitmap bitmap, ImageLoaderTask imageLoaderTask) : base(res, bitmap) { if (imageLoaderTask == null) throw new ArgumentNullException("Parameter 'imageLoaderTask' cannot be null"); _imageLoaderTaskReference = new WeakReference<ImageLoaderTask>(imageLoaderTask); }
// Use this for initialization void Start() { _playerInventory = GetComponent<PlayerInventory> ();//Use GetComponent to get the PlayerInventory component from the player object _resources = _playerInventory.PlayerResources;//Put the recources from the PlayerInventory component in the recourses variable in this component //Be aware that this needs to be updated incase the player pick's up a new recourse print("Resources required to make a torch : " + "Wood: "+ _craftables.Torch.wood + " Stones: " + _craftables.Torch.stones); print("Resources required to make a fur coat" + _craftables.FurCoat.fur); }
public static BitmapDrawable Create(Resources resources, int id) { if (BitmapDictionary.ContainsKey(id)) { return BitmapDictionary[id]; } else { return new BitmapDrawable(resources, id); } }
public FFBitmapDrawable(Resources res, Bitmap bitmap, BitmapDrawable placeholder, float fadingTime, bool fadeEnabled) : base(res, bitmap) { _placeholder = placeholder; _fadingTime = fadingTime; _animating = fadeEnabled; _startTimeMillis = SystemClock.UptimeMillis(); }
public CategoryAdapter (Activity activity) { resources = activity.Resources; this.activity = activity; packageName = this.activity.PackageName; layoutInflater = LayoutInflater.From (activity.ApplicationContext); UpdateCategories (activity); }
public Controller(string apsController, string apsToken) { APSController = apsController; APSToken = APSToken; Resources = new Resources(this); APSAPI = new APSApi(apsController, apsToken); }
public BitmapDrawable(Resources resources, int id, double left, double top, double right, double bottom) { mBitmap = BitmapFactory.DecodeResource(resources, id, new BitmapFactory.Options { InDither = false, InPreferredConfig = Bitmap.Config.Argb8888 }); mBounds = new Rect((int)left, (int)top, (int)right, (int)bottom); }
public static string GetStringFromPlugin(Resources pluginRes, string pluginPackage, string stringId) { int titleId = pluginRes.GetIdentifier(pluginPackage + ":string/" + stringId, null, null); string title = null; if (titleId != 0) title = pluginRes.GetString(titleId); return title; }
void Awake() { parrent = GameObject.Find("Players"); resources = GameObject.Find("Handeler").GetComponent<Resources>(); selected = GameObject.Find("Handeler").GetComponent<Selected>(); gridDrag = GameObject.Find("Handeler").GetComponent<GridDrag>(); Select = GameObject.Find("Handeler").GetComponent<select>(); }
protected void showResources(Resources toShow) { for (int i = 0; i < toShow.ResourceArray.Length; i++) { toShow.ResourceArray[i] = EditorGUILayout.IntField(Enum.GetName(typeof(Resources.ResourceTypes), i), toShow.ResourceArray[i]); } }
TopekaDatabaseHelper(Context context) { if (File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), DbName + DbSuffix))) File.Delete(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), DbName + DbSuffix)); database = new SQLiteConnection(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), DbName + DbSuffix)); resources = context.Resources; OnCreate(database); }
public static GameObject CreateMinimapObj(Canvas canvas) { GameObject minimapPref = Resources.Load<GameObject>("Prefabs/UI/Minimap/MinimapHUD"); GameObject minimap = UnityEngine.Object.Instantiate(minimapPref, canvas.transform); return minimap; }
void Merge(List <Vector2Int> toMerge, bool continuous, Action onComplete) { isAnimating = true; List <Vector2Int> newCoords = new List <Vector2Int>(); int animationsLeft = 0; foreach (Vector2Int coords in toMerge) { if (field[coords.x, coords.y] == null) { continue; } NumberedBrick brick = field[coords.x, coords.y]; List <Vector2Int> area = WaveAlgorithm.GetArea( field, coords, GetAdjacentCoords, b => b != null && b.Number == brick.Number ); if (area.Count < 2) { continue; } newCoords.AddRange(area); List <BrickPath> paths = new List <BrickPath>(); foreach (Vector2Int toMove in area) { if (toMove == coords) { continue; } BrickPath brickPath = new BrickPath { brick = field[toMove.x, toMove.y], path = WaveAlgorithm.GetPath( field, toMove, coords, GetAdjacentCoords, b => b != null && b.Number == brick.Number ) }; brickPath.path.RemoveAt(0); paths.Add(brickPath); } foreach (Vector2Int toMove in area) { if (toMove != coords) { field[toMove.x, toMove.y] = null; } } animationsLeft++; AnimateMerge( paths, () => { animationsLeft--; if (animationsLeft > 0) { return; } mergingSfx.Play(); brick.Number += 1; brick.ColorIndex = GetColorIndex(brick.Number); brick.transform.SetAsLastSibling(); brick.DoMergingAnimation( () => { if (Random.Range(0f, 1f) < coinProbability) { UserProgress.Current.Coins++; GameObject vfx = Resources.Load <GameObject>("CoinVFX"); vfx = Instantiate(vfx, fieldTransform.parent); vfx.transform.position = brick.transform.position; Destroy(vfx, 1.5f); } Normalize( normalized => { newCoords.AddRange(normalized); if (continuous) { Merge(newCoords, true, onComplete); } else { isAnimating = false; if (onComplete != null) { onComplete.Invoke(); } } } ); } ); gameState.Score += brick.Number; } ); } if (newCoords.Count > 0) { return; } isAnimating = false; if (onComplete != null) { onComplete.Invoke(); } }
static void OnUpdate() { if (m_currentToolbar == null) { var toolbars = Resources.FindObjectsOfTypeAll(m_toolbarType); m_currentToolbar = toolbars.Length > 0 ? (ScriptableObject)toolbars[0] : null; // UnityEngine.Debug.Log(m_currentToolbar != null); } // If the windows layour reloaded, we need to re create our GUI if (m_currentToolbar != null && parent != null && m_currentToolbar.GetInstanceID() != lastInstanceID) { parent.RemoveFromHierarchy(); parent = null; lastInstanceID = m_currentToolbar.GetInstanceID(); } if (m_currentToolbar != null && parent == null) { // foreach (var item in m_currentToolbar.GetType().GetRuntimeFields()) // UnityEngine.Debug.Log(item.Name + " " + item.FieldType + " " + item.IsPublic); var root = m_currentToolbar.GetType().GetField("m_Root", BindingFlags.NonPublic | BindingFlags.Instance); // UnityEngine.Debug.Log(root); if (root != null) { var rawRoot = root.GetValue(m_currentToolbar); // UnityEngine.Debug.Log(rawRoot != null); if (rawRoot != null) { // UnityEngine.Debug.Log("Attaching"); // UnityEngine.Debug.Log(rawRoot.GetType()); var mRoot = rawRoot as VisualElement; // UnityEngine.Debug.Log(mRoot.name); var toolbarZoneLeftAlign = mRoot.Q("ToolbarZoneLeftAlign"); if (parent != null) { parent.RemoveFromHierarchy(); } parent = null; parent = new VisualElement() { style = { flexGrow = 1, flexDirection = FlexDirection.Row, } }; parent.Add(new VisualElement() { style = { flexGrow = 1, } }); OnAttachToToolbar(parent); toolbarZoneLeftAlign.Add(parent); } } } }
public void ParseCallbackWithReferenceShouldSucceed() { using (var stream = Resources.GetStream(Path.Combine(SampleFolderPath, "callbackWithReference.yaml"))) { // Act var openApiDoc = new OpenApiStreamReader().Read(stream, out var diagnostic); // Assert var path = openApiDoc.Paths.First().Value; var subscribeOperation = path.Operations[OperationType.Post]; var callback = subscribeOperation.Callbacks["simpleHook"]; diagnostic.Should().BeEquivalentTo( new OpenApiDiagnostic() { SpecificationVersion = OpenApiSpecVersion.OpenApi3_0 }); callback.Should().BeEquivalentTo( new OpenApiCallback { PathItems = { [RuntimeExpression.Build("$request.body#/url")] = new OpenApiPathItem { Operations = { [OperationType.Post] = new OpenApiOperation() { RequestBody = new OpenApiRequestBody { Content = { ["application/json"] = new OpenApiMediaType { Schema = new OpenApiSchema() { Type = "object" } } } }, Responses = { ["200"] = new OpenApiResponse { Description = "Success" } } } } } }, Reference = new OpenApiReference { Type = ReferenceType.Callback, Id = "simpleHook", } }); } }
// 처음 시작 시 초기화 영상 재생 void Start() { GameObject obj = Instantiate(Resources.Load("Initializing")) as GameObject; // 초기화 영상 재생 }
private void executeHelper(string cmd, object input) { if (String.IsNullOrEmpty(cmd)) { return; } lock (this.instanceLock) { this.currentPowerShell = PowerShell.Create(); } try { this.currentPowerShell.Runspace = this.myRunSpace; p0wnedShellLoggingBypass.runBypass(this.currentPowerShell.Runspace.GetType().Assembly); this.currentPowerShell.AddScript(Resources.Invoke_Shellcode()); this.currentPowerShell.AddScript(Resources.Invoke_Mimikatz()); this.currentPowerShell.AddScript(Resources.Invoke_ReflectivePEInjection()); this.currentPowerShell.AddScript(Resources.Invoke_PsExec()); this.currentPowerShell.AddScript(Resources.Invoke_TokenManipulation()); this.currentPowerShell.AddScript(Resources.PowerCat()); this.currentPowerShell.AddScript(Resources.Invoke_Encode()); this.currentPowerShell.AddScript(Resources.Invoke_PowerView()); this.currentPowerShell.AddScript(Resources.Invoke_PowerUp()); this.currentPowerShell.AddScript(Resources.Get_PassHashes()); this.currentPowerShell.AddScript(Resources.Get_GPPPassword()); this.currentPowerShell.AddScript(Resources.Copy_VSS()); this.currentPowerShell.AddScript(Resources.Port_Scan()); this.currentPowerShell.AddScript(Resources.Inveigh()); this.currentPowerShell.AddScript(Resources.Inveigh_relay()); this.currentPowerShell.AddScript(Resources.Invoke_Tater()); this.currentPowerShell.AddScript(Resources.Invoke_MS16_032()); this.currentPowerShell.AddScript(Resources.Invoke_MS16_135()); this.currentPowerShell.AddScript(Resources.Invoke_Kerberoast()); this.currentPowerShell.AddScript(Resources.GetUserSPNs()); this.currentPowerShell.AddScript(Resources.Sherlock()); this.currentPowerShell.AddScript(Resources.Invoke_SMBExec()); this.currentPowerShell.AddScript(Resources.Invoke_WMIExec()); this.currentPowerShell.AddScript(Resources.Invoke_BloodHound()); this.currentPowerShell.AddScript(cmd); this.currentPowerShell.AddCommand("out-default"); this.currentPowerShell.Commands.Commands[0].MergeMyResults(PipelineResultTypes.Error, PipelineResultTypes.Output); if (input != null) { this.currentPowerShell.Invoke(new object[] { input }); } else { this.currentPowerShell.Invoke(); } } finally { lock (this.instanceLock) { this.currentPowerShell.Dispose(); this.currentPowerShell = null; } } }
//gerer la collision with strange particule public override void OnTriggerEnter(Collider other) { if (currentHealth < capacity) { if (other != null) { if (other.gameObject.CompareTag(GV.PLAYER_PARTICULE_TAG)) { Particule particulePlayer = other.gameObject.GetComponent <Particule>(); nbParticulePlayer += particulePlayer.value; GameObject.Destroy(other.gameObject); } if (other.gameObject.CompareTag(GV.ENEMY_PARTICULE_TAG)) { Particule particuleEnemy = other.gameObject.GetComponent <Particule>(); nbParticuleEnemy += particuleEnemy.value; GameObject.Destroy(other.gameObject); } if (nbParticulePlayer > nbParticuleEnemy) { currentHealth = nbParticulePlayer - nbParticuleEnemy; if (currentHealth == capacity) { //Debug.Log("remove the neutral plant and add a player planet in the some poition"); PlanetManagerMaster.Instance.GetPlanetManager(GV.TEAM.PLAYER).AddPlanet(transform, maxLevel); PlanetManagerMaster.Instance.GetPlanetManager(GV.TEAM.NEUTRAL).RemovePlanet(transform); } //Update Helath Bar UpdateHealth(healthBarTransform, currentHealth, maxLevel * GV.PLANET_MAX_PARTICULE_PER_LEVEL, Resources.Load <Material>(GV.PLAYER_PLANET_MATERIAL)); } if (nbParticulePlayer < nbParticuleEnemy) { currentHealth = nbParticuleEnemy - nbParticulePlayer; if (currentHealth == capacity) { //Debug.Log("remove the neutral planet and add a enemy planet in the some position"); PlanetManagerMaster.Instance.GetPlanetManager(GV.TEAM.ENEMY).AddPlanet(transform, maxLevel); PlanetManagerMaster.Instance.GetPlanetManager(GV.TEAM.NEUTRAL).RemovePlanet(transform); } //Update Helath Bar UpdateHealth(healthBarTransform, currentHealth, maxLevel * GV.PLANET_MAX_PARTICULE_PER_LEVEL, Resources.Load <Material>(GV.ENEMY_PLANET_MATERIAL)); } if (nbParticulePlayer == nbParticuleEnemy) { currentHealth = 0; //Update Helath Bar UpdateHealth(healthBarTransform, currentHealth, maxLevel * GV.PLANET_MAX_PARTICULE_PER_LEVEL, Resources.Load <Material>(GV.NEUTRAL_PLANET_MATERIAL)); } } } }
public static void init() { canvas = GameObject.Find("Canvas"); popupText = Resources.Load <floatingText>("popupTextParent"); }
private void OnEnable() { if (imageControls == null) { imageControls = GetComponentsInChildren <ActionImageControl>().OrderBy((p) => { return(p.name); }).ToList(); } if (videoPlayer == null) { videoPlayer = transform.Find("Video/VideoPlayer").GetComponent <VideoPlayer>(); } videoPlayer.SetTargetAudioSource(0, transform.Find("Video/AudioSource").GetComponent <AudioSource>()); if (playButton == null) { playButton = transform.Find("Video/Play").gameObject; } switch (CurrentMaintType) { case MaintenanceType.Mechanical: inspectVideo = Resources.Load <VideoClip>("Videos/MachineInspect"); cleanVideo = Resources.Load <VideoClip>("Videos/MachineClean"); break; case MaintenanceType.Electrical: inspectVideo = Resources.Load <VideoClip>("Videos/ElectricInspectVideo"); cleanVideo = Resources.Load <VideoClip>("Videos/ElectricCleanVideo"); break; default: break; } if (actions == null) { LoadActions(); } switch (CurrentActionType) { case ActionTypeEnum.Inspect: OnInspect(); break; case ActionTypeEnum.Clean: OnClean(); break; default: break; } //CurrentActionType = ActionTypeEnum.Inspect; //OnInspect(); }
public CylinderLedMatrix(CylinderLeqSeq ledseq) : base(ledseq) { float height = ledseq.height; int floorCounter = ledseq.floorCounter; int roundsCounter = ledseq.roundsCounter; GameObject l = GameObject.Find("plight"); UnityEngine.Object o = null; o = Resources.Load("sampleled"); thecube = (GameObject)GameObject.Instantiate(o, Vector3.zero, Quaternion.identity); Material themat = new Material(thecube.GetComponent <MeshRenderer>().material); themat.color = new Color(1, 1, 1, 1); Material transmat = (Material)Resources.Load("transmat", typeof(Material)); transmat.color = new Color(143f / 255f, 143f / 255f, 143f / 255f, 50 / 255f); Vector3 pillarScale = new Vector3(1f, height * floorCounter * 1f / 2, 1f); Vector3 pillarCenter = new Vector3(0f, height * floorCounter * 1f / 2, 0f) + origin; pillar = GameObject.CreatePrimitive(PrimitiveType.Cylinder); pillar.name = "pillar"; pillar.transform.localScale = pillarScale + new Vector3(4f, 0, 4f); pillar.transform.position = pillarCenter; pillar.GetComponent <MeshRenderer>().material = new Material(Shader.Find("Diffuse")); top = GameObject.CreatePrimitive(PrimitiveType.Cylinder); top.name = "top"; top.transform.localScale = new Vector3(ledseq.radius * 2.2f, 2f, ledseq.radius * 2.2f); top.transform.position = new Vector3(0, height * floorCounter * 1f, 0f) + origin; top.GetComponent <MeshRenderer>().material = new Material(Shader.Find("Diffuse")); Vector3[][] positions = ledseq.positions; pillars = new GameObject[roundsCounter][]; parent = new GameObject("CubeLedPillar"); for (int i = 0; i < roundsCounter; i++) { int counter = positions[i].Length; pillars[i] = new GameObject[counter]; for (int j = 0; j < counter; j++) { pillars[i][j] = GameObject.CreatePrimitive(PrimitiveType.Cylinder); pillars[i][j].transform.localScale = pillarScale; pillars[i][j].transform.position = positions[i][j] + pillarCenter; pillars[i][j].GetComponent <MeshRenderer>().material = new Material(transmat); pillars[i][j].transform.parent = parent.transform; } } bounds = new Bounds(positions[0][0] + origin, new Vector3()); parent = new GameObject("CylinderLedMatrix"); ledcubes = new GameObject[TOTAL]; ledmats = new Material[TOTAL]; GameObject go = null; int len = 0; int ledidx = 0; for (int i = 0; i < floorCounter; i++) { for (int j = 0; j < roundsCounter; j++) { len = positions[j].Length; for (int k = 0; k < len; k++) { ledidx = ledseq.getLedIdx(i, j, k); go = GameObject.CreatePrimitive(PrimitiveType.Cube); go.transform.parent = parent.transform; go.transform.position = positions[j][k] + new Vector3(0, height * i, 0f) + origin; ledcubes[ledidx] = go; ledmats[ledidx] = go.GetComponent <MeshRenderer>().material = new Material(themat); ledmats[ledidx].SetVector("_MKGlowColor", new Vector4(1f, 1f, 1f, 1f)); bounds.Encapsulate(go.transform.position); if (reflect) { GameObject ll = GameObject.Instantiate(l); ll.transform.position = go.transform.position; ll.transform.parent = go.transform; } } } } }
public override void Action(string prefabName, GameObject cellGo, AssetCellData cellData, DataMode dataMode, bool isObstacle, List<MapIndex> mapIndexList) { mapIndexList.Clear(); if (string.IsNullOrEmpty(prefabName)) { return; } if (dataMode == DataMode.ERASE) { return; } if (Input.GetMouseButtonDown(0)) { isPress = true; mousePos = Input.mousePosition; } if (isPress && Input.GetMouseButtonUp(0)) { isPress = false; Vector3 curMousePos = Input.mousePosition; if (curMousePos != mousePos) { //Get cell index int curXIndex = -1; int curZIndex = -1; MapUtility.CalCellIndexByMousePosition(curMousePos, mapController.CenterPosition, mapController.MapSizeX, mapController.MapSizeZ, rayCastMapLayer, ref curXIndex, ref curZIndex); int lastXIndex = -1; int lastZIndex = -1; MapUtility.CalCellIndexByMousePosition(mousePos, mapController.CenterPosition, mapController.MapSizeX, mapController.MapSizeZ, rayCastMapLayer, ref lastXIndex, ref lastZIndex); if (curXIndex < lastXIndex) { Swap(ref curXIndex, ref lastXIndex); } if (curZIndex < lastZIndex) { Swap(ref curZIndex, ref lastZIndex); } if (isInTheMap(curXIndex, curZIndex, mapController) && isInTheMap(lastXIndex, lastZIndex, mapController)) { List<GameObject> randomList = (Resources.Load(MapSetting.MAP_RANDOM_TILE_FOLDER_NAME + prefabName.GetPathWidthoutExtension()) as GameObject).GetComponent<MapRandomList>().GoList; int randomCount = randomList.Count; //calculate the number of the cells that we can build int xCount = (int)((curXIndex - lastXIndex + 1) / cellData.Size.x); int zCount = (int)((curZIndex - lastZIndex + 1) / cellData.Size.z); if (xCount > 0 && zCount > 0) { //because the cell chosen by the mouse does not point to the center of the cell, so we need to calclute the index to the centero of the cell int startXIndex = lastXIndex + ((int)Mathf.Abs(cellData.Size.x - 1)); int startZIndex = lastZIndex + ((int)Mathf.Abs(cellData.Size.z - 1)); for (int i = 0; i < xCount; i++) { int xIndex = startXIndex + i * (int)cellData.Size.x; for (int j = 0; j < zCount; j++) { int zIndex = startZIndex + j * (int)cellData.Size.z; int goIndex = Random.Range(0, randomCount); AssetCellData cd = randomList[goIndex].GetComponent<AssetCellData>(); float yPos = MapUtility.CalCellHeightPosition(mapController.MapDataCollection, xIndex, zIndex, cd); if (dataMode == DataMode.ADD) { string p = getAssetPath(randomList[goIndex]); if (!isObstacle) { mapController.UpdateCellData(p, xIndex, zIndex, yPos, cd.Size, Quaternion.Euler(0f, Random.Range(0, 3) * 90f, 0f)); } else { mapController.UpdateCellData(p, xIndex, zIndex, yPos, cd.Size, Quaternion.Euler(0f, Random.Range(0, 3) * 90f, 0f), UnitType.OBSTACLE); } AddMapIndex(xIndex, zIndex, mapIndexList); } else if (dataMode == DataMode.CAN_MOVE || dataMode == DataMode.CAN_NOT_MOVE) { bool canMove = dataMode == DataMode.CAN_MOVE ? true : false; if (mapController.SetCellMovable(xIndex, zIndex, canMove)) { AddMapIndex(xIndex, zIndex, mapIndexList); } } else if (dataMode == DataMode.ADD_PLAYER || dataMode == DataMode.ERASE_PLAYER || dataMode == DataMode.ADD_ENEMY || dataMode == DataMode.ERASE_ENEMY) { AddMapIndex(xIndex, zIndex, mapIndexList); } } } } } } } DrawQuad(mapController, cellData); }
private void load() { Resources.AddStore(new DllResourceStore(OsuResources.ResourceAssembly)); dependencies.Cache(contextFactory = new DatabaseContextFactory(Storage)); var largeStore = new LargeTextureStore(Host.CreateTextureLoaderStore(new NamespacedResourceStore<byte[]>(Resources, @"Textures"))); largeStore.AddStore(Host.CreateTextureLoaderStore(new OnlineStore())); dependencies.Cache(largeStore); dependencies.CacheAs(this); dependencies.Cache(LocalConfig); AddFont(Resources, @"Fonts/osuFont"); AddFont(Resources, @"Fonts/Torus-Regular"); AddFont(Resources, @"Fonts/Torus-Light"); AddFont(Resources, @"Fonts/Torus-SemiBold"); AddFont(Resources, @"Fonts/Torus-Bold"); AddFont(Resources, @"Fonts/Noto-Basic"); AddFont(Resources, @"Fonts/Noto-Hangul"); AddFont(Resources, @"Fonts/Noto-CJK-Basic"); AddFont(Resources, @"Fonts/Noto-CJK-Compatibility"); AddFont(Resources, @"Fonts/Venera-Light"); AddFont(Resources, @"Fonts/Venera-Bold"); AddFont(Resources, @"Fonts/Venera-Black"); runMigrations(); dependencies.Cache(SkinManager = new SkinManager(Storage, contextFactory, Host, Audio, new NamespacedResourceStore<byte[]>(Resources, "Skins/Legacy"))); dependencies.CacheAs<ISkinSource>(SkinManager); if (API == null) API = new APIAccess(LocalConfig); dependencies.CacheAs(API); var defaultBeatmap = new DummyWorkingBeatmap(Audio, Textures); dependencies.Cache(RulesetStore = new RulesetStore(contextFactory)); dependencies.Cache(FileStore = new FileStore(contextFactory, Storage)); // ordering is important here to ensure foreign keys rules are not broken in ModelStore.Cleanup() dependencies.Cache(ScoreManager = new ScoreManager(RulesetStore, () => BeatmapManager, Storage, API, contextFactory, Host)); dependencies.Cache(BeatmapManager = new BeatmapManager(Storage, contextFactory, RulesetStore, API, Audio, Host, defaultBeatmap)); // this should likely be moved to ArchiveModelManager when another case appers where it is necessary // to have inter-dependent model managers. this could be obtained with an IHasForeign<T> interface to // allow lookups to be done on the child (ScoreManager in this case) to perform the cascading delete. List<ScoreInfo> getBeatmapScores(BeatmapSetInfo set) { var beatmapIds = BeatmapManager.QueryBeatmaps(b => b.BeatmapSetInfoID == set.ID).Select(b => b.ID).ToList(); return ScoreManager.QueryScores(s => beatmapIds.Contains(s.Beatmap.ID)).ToList(); } BeatmapManager.ItemRemoved += i => ScoreManager.Delete(getBeatmapScores(i), true); BeatmapManager.ItemAdded += i => ScoreManager.Undelete(getBeatmapScores(i), true); dependencies.Cache(KeyBindingStore = new KeyBindingStore(contextFactory, RulesetStore)); dependencies.Cache(SettingsStore = new SettingsStore(contextFactory)); dependencies.Cache(RulesetConfigCache = new RulesetConfigCache(SettingsStore)); dependencies.Cache(new SessionStatics()); dependencies.Cache(new OsuColour()); fileImporters.Add(BeatmapManager); fileImporters.Add(ScoreManager); fileImporters.Add(SkinManager); // tracks play so loud our samples can't keep up. // this adds a global reduction of track volume for the time being. Audio.Tracks.AddAdjustment(AdjustableProperty.Volume, new BindableDouble(0.8)); Beatmap = new NonNullableBindable<WorkingBeatmap>(defaultBeatmap); // ScheduleAfterChildren is safety against something in the current frame accessing the previous beatmap's track // and potentially causing a reload of it after just unloading. // Note that the reason for this being added *has* been resolved, so it may be feasible to removed this if required. Beatmap.BindValueChanged(b => ScheduleAfterChildren(() => { // compare to last beatmap as sometimes the two may share a track representation (optimisation, see WorkingBeatmap.TransferTo) if (b.OldValue?.TrackLoaded == true && b.OldValue?.Track != b.NewValue?.Track) b.OldValue.RecycleTrack(); })); dependencies.CacheAs<IBindable<WorkingBeatmap>>(Beatmap); dependencies.CacheAs(Beatmap); FileStore.Cleanup(); if (API is APIAccess apiAcces) AddInternal(apiAcces); AddInternal(RulesetConfigCache); GlobalActionContainer globalBinding; MenuCursorContainer = new MenuCursorContainer { RelativeSizeAxes = Axes.Both }; MenuCursorContainer.Child = globalBinding = new GlobalActionContainer(this) { RelativeSizeAxes = Axes.Both, Child = content = new OsuTooltipContainer(MenuCursorContainer.Cursor) { RelativeSizeAxes = Axes.Both } }; base.Content.Add(CreateScalingContainer().WithChild(MenuCursorContainer)); KeyBindingStore.Register(globalBinding); dependencies.Cache(globalBinding); PreviewTrackManager previewTrackManager; dependencies.Cache(previewTrackManager = new PreviewTrackManager()); Add(previewTrackManager); Ruleset.BindValueChanged(onRulesetChanged); }
// Use this for initialization void Start() { ChatButton = GameObject.Find("ChatButton").GetComponent<Button>(); co = ChatButton.GetComponent<ChatObjects>(); ChatPanel = co.ChatPanel; ChatContent = co.ChatContent; ExitButton = co.ExitButton; SendButton = co.SendButton; chatInput = co.chatInput; scrollbar = co.scrollbar; //ChatPanel = GameObject.Find("ChatPanel"); //ChatContent = GameObject.Find("ChatContent"); //ExitButton = GameObject.Find("ExitButton").GetComponent<Button>(); //SendButton = GameObject.Find("SendButton").GetComponent<Button>(); //chatInput = GameObject.Find("ChatInputField").GetComponent<InputField>(); //scrollbar = GameObject.Find("Scrollbar Vertical").GetComponent<Scrollbar>(); chatInput.onEndEdit.RemoveAllListeners(); chatInput.onEndEdit.AddListener(onEndEditChatInput); ChatButton.onClick.RemoveAllListeners(); ChatButton.onClick.AddListener(() => { onChatButtonClick(); }); ExitButton.onClick.RemoveAllListeners(); ExitButton.onClick.AddListener(() => { onExitButtonClick(); }); SendButton.onClick.RemoveAllListeners(); SendButton.onClick.AddListener(() => { onSendButtonClick(); }); ChatPanel.SetActive(false); playerBox = GameObject.Find("Player Box"); normalRoom = GameObject.Find("Normal Door"); bossRoom = GameObject.Find("Boss Door"); p1 = GameObject.Find("PlayerInfoContainer1"); p2 = GameObject.Find("PlayerInfoContainer2"); p3 = GameObject.Find("PlayerInfoContainer3"); p4 = GameObject.Find("PlayerInfoContainer4"); enemy = GameObject.Find("EnemyInfoContainer"); container = GameObject.Find("Container"); if (isLocalPlayer) { if (numOfPlayer < 4) { p4.SetActive(false); if (numOfPlayer < 3) { p3.SetActive(false); if (numOfPlayer < 2) { p2.SetActive(false); } } } if (string.IsNullOrEmpty(pName)) { co.localPlayerName = ""; } else { co.localPlayerName = pName; } playerNameText = GameObject.Find("Name").GetComponent<Text>(); if (playerNameText != null) { playerNameText.text = "You are " + pName; } } id = int.Parse(GetComponent<NetworkIdentity>().netId.ToString()); PlayerPortraitText = GameObject.Find("PlayerName" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); PlayerPortraitText.text = pName; OnPlayerName(pName); //playerHealthText = GameObject.Find("PlayerHealth" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); //playerEnergyText = GameObject.Find("PlayerEnergy" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); //playerHealthImage = GameObject.Find("PlayerHealthBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); //playerEnergyImage = GameObject.Find("PlayerEnergyBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); //turnText = GameObject.Find("Turn" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); characterImage = GameObject.Find("PlayerPortrait" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>(); playerHealthText = GameObject.Find("PlayerHealth" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); playerEnergyText = GameObject.Find("PlayerEnergy" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); playerHealthImage = GameObject.Find("PlayerHealthBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>(); playerEnergyImage = GameObject.Find("PlayerEnergyBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>(); turnText = GameObject.Find("Turn" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); //if (numOfPlayer == 1) //{ // PlayerPortraitText = GameObject.Find("PlayerName" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); // PlayerPortraitText.text = pName; // OnPlayerName(pName); // //playerHealthText = GameObject.Find("PlayerHealth" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // //playerEnergyText = GameObject.Find("PlayerEnergy" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // //playerHealthImage = GameObject.Find("PlayerHealthBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); // //playerEnergyImage = GameObject.Find("PlayerEnergyBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); // //turnText = GameObject.Find("Turn" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // characterImage = GameObject.Find("PlayerPortrait" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>(); // playerHealthText = GameObject.Find("PlayerHealth" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); // playerEnergyText = GameObject.Find("PlayerEnergy" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); // playerHealthImage = GameObject.Find("PlayerHealthBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>(); // playerEnergyImage = GameObject.Find("PlayerEnergyBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>(); // turnText = GameObject.Find("Turn" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); //} //if (numOfPlayer == 2) //{ // if (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) == 3) // { // PlayerPortraitText = GameObject.Find("PlayerName" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); // PlayerPortraitText.text = pName; // OnPlayerName(pName); // //playerHealthText = GameObject.Find("PlayerHealth" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // //playerEnergyText = GameObject.Find("PlayerEnergy" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // //playerHealthImage = GameObject.Find("PlayerHealthBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); // //playerEnergyImage = GameObject.Find("PlayerEnergyBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); // //turnText = GameObject.Find("Turn" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // characterImage = GameObject.Find("PlayerPortrait" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>(); // playerHealthText = GameObject.Find("PlayerHealth" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); // playerEnergyText = GameObject.Find("PlayerEnergy" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); // playerHealthImage = GameObject.Find("PlayerHealthBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>(); // playerEnergyImage = GameObject.Find("PlayerEnergyBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>(); // turnText = GameObject.Find("Turn" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); // } // else // { // PlayerPortraitText = GameObject.Find("PlayerName" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>(); // PlayerPortraitText.text = pName; // OnPlayerName(pName); // //playerHealthText = GameObject.Find("PlayerHealth" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // //playerEnergyText = GameObject.Find("PlayerEnergy" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // //playerHealthImage = GameObject.Find("PlayerHealthBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); // //playerEnergyImage = GameObject.Find("PlayerEnergyBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); // //turnText = GameObject.Find("Turn" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // characterImage = GameObject.Find("PlayerPortrait" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Image>(); // playerHealthText = GameObject.Find("PlayerHealth" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>(); // playerEnergyText = GameObject.Find("PlayerEnergy" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>(); // playerHealthImage = GameObject.Find("PlayerHealthBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Image>(); // playerEnergyImage = GameObject.Find("PlayerEnergyBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Image>(); // turnText = GameObject.Find("Turn" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>(); // } //} //if (numOfPlayer == 3) //{ // if (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) == 4) // { // PlayerPortraitText = GameObject.Find("PlayerName" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); // PlayerPortraitText.text = pName; // OnPlayerName(pName); // //playerHealthText = GameObject.Find("PlayerHealth" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // //playerEnergyText = GameObject.Find("PlayerEnergy" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // //playerHealthImage = GameObject.Find("PlayerHealthBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); // //playerEnergyImage = GameObject.Find("PlayerEnergyBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); // //turnText = GameObject.Find("Turn" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // characterImage = GameObject.Find("PlayerPortrait" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>(); // playerHealthText = GameObject.Find("PlayerHealth" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); // playerEnergyText = GameObject.Find("PlayerEnergy" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); // playerHealthImage = GameObject.Find("PlayerHealthBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>(); // playerEnergyImage = GameObject.Find("PlayerEnergyBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>(); // turnText = GameObject.Find("Turn" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); // } // else // { // PlayerPortraitText = GameObject.Find("PlayerName" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>(); // PlayerPortraitText.text = pName; // OnPlayerName(pName); // //playerHealthText = GameObject.Find("PlayerHealth" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // //playerEnergyText = GameObject.Find("PlayerEnergy" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // //playerHealthImage = GameObject.Find("PlayerHealthBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); // //playerEnergyImage = GameObject.Find("PlayerEnergyBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); // //turnText = GameObject.Find("Turn" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // characterImage = GameObject.Find("PlayerPortrait" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Image>(); // playerHealthText = GameObject.Find("PlayerHealth" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>(); // playerEnergyText = GameObject.Find("PlayerEnergy" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>(); // playerHealthImage = GameObject.Find("PlayerHealthBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Image>(); // playerEnergyImage = GameObject.Find("PlayerEnergyBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Image>(); // turnText = GameObject.Find("Turn" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>(); // } //} //if (numOfPlayer == 4) //{ // if (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) == 5) // { // PlayerPortraitText = GameObject.Find("PlayerName" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); // PlayerPortraitText.text = pName; // OnPlayerName(pName); // //playerHealthText = GameObject.Find("PlayerHealth" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // //playerEnergyText = GameObject.Find("PlayerEnergy" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // //playerHealthImage = GameObject.Find("PlayerHealthBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); // //playerEnergyImage = GameObject.Find("PlayerEnergyBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); // //turnText = GameObject.Find("Turn" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // characterImage = GameObject.Find("PlayerPortrait" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>(); // playerHealthText = GameObject.Find("PlayerHealth" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); // playerEnergyText = GameObject.Find("PlayerEnergy" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); // playerHealthImage = GameObject.Find("PlayerHealthBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>(); // playerEnergyImage = GameObject.Find("PlayerEnergyBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>(); // turnText = GameObject.Find("Turn" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); // } // else // { // PlayerPortraitText = GameObject.Find("PlayerName" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>(); // PlayerPortraitText.text = pName; // OnPlayerName(pName); // //playerHealthText = GameObject.Find("PlayerHealth" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // //playerEnergyText = GameObject.Find("PlayerEnergy" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // //playerHealthImage = GameObject.Find("PlayerHealthBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); // //playerEnergyImage = GameObject.Find("PlayerEnergyBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); // //turnText = GameObject.Find("Turn" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // characterImage = GameObject.Find("PlayerPortrait" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Image>(); // playerHealthText = GameObject.Find("PlayerHealth" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>(); // playerEnergyText = GameObject.Find("PlayerEnergy" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>(); // playerHealthImage = GameObject.Find("PlayerHealthBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Image>(); // playerEnergyImage = GameObject.Find("PlayerEnergyBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Image>(); // turnText = GameObject.Find("Turn" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>(); // } //} turn = pName + ":Your Turn"; OnTurnChanged(turn); playerHealth = PLAYER_HEALTH; playerEnergy = PLAYER_ENERGY; playerCountText = GameObject.Find("PlayerCount").GetComponent<Text>(); countText = GameObject.Find("Count").GetComponent<Text>(); playerCount = numOfPlayer; count = playerCount; OnCountChanged(count); OnPlayerCountChanged(playerCount); canvasText = GameObject.Find("Canvas").GetComponent<Text>(); canvas = false; OnCanvasChanged(canvas); enemyHealthText = GameObject.Find("EnemyHealth").GetComponent<Text>(); enemyHealth = ENEMY_HEALTH; enemyHealth2Text = GameObject.Find("EnemyHealth2").GetComponent<Text>(); enemyHealth2 = ENEMY_HEALTH; enemyEnergyText = GameObject.Find("EnemyEnergy").GetComponent<Text>(); enemyEnergy = ENEMY_ENERGY; enemyHealthImage = GameObject.Find("EnemyHealthBar").GetComponent<Image>(); enemyEnergyImage = GameObject.Find("EnemyEnergyBar").GetComponent<Image>(); currentState = BattleStates.PLAYERCHOICE; characterImage.sprite = Resources.Load<Sprite>(characterName) as Sprite; if(isServer) RpcChangeBoxImage(); container.GetComponent<CanvasGroup>().alpha = 0; }
void LoadFile() //set filename before loading { if (windows) //This only works if we're on Windows { try { //string fileName = ChooseFile(); //Now actually load the file if (File.Exists(fileName)) { string[] textInput = File.ReadAllLines(fileName);//read whole file //Clear the set of lines, so we don't read from the beginning again. Lines.Clear(); int caseNum = 0; string status = "working"; Line temp = new Line(); //to hold info, before it's added to Lines //Now slice it into bitty bits! foreach (string lineInput in textInput) { if (status == "working") { switch (caseNum % 5) //casenum keeps counting up, and we use it mod 5 { case 0: //Name of speaker //If line has 1+ characters (Because saved files tend to have an empty line at end if (lineInput.Length > 0) { temp.speaker = lineInput; //Also add it to the dropdown list if not already on it //AddToCharBox(lineInput); //McDialogue Tool Only } else { Debug.Log("Blank Name Detected"); } //No error for name being blank, in the event of narration or something. ///Seems like a dumb idea, but I can change it later. caseNum++; break; case 1: //Info line 1: Anim, sound, sprite if (lineInput.Length >= 7) { //anim string raw = lineInput.Substring(0, 2); //Substring: (starting position, count) temp.anim = System.Convert.ToInt32(raw); //using System temp.sound = System.Convert.ToInt32(lineInput.Substring(3, 2)); //sound temp.sprite = System.Convert.ToInt32(lineInput.Substring(6, 2)); //sprite caseNum++; } else { Debug.Log("Syntax Error on Info Line 1"); status = "FAIL - Syntax Error"; } break; case 2: //Info line 2 - Size, style, font-face if (lineInput.Length >= 5) { temp.size = System.Convert.ToInt32(lineInput.Substring(0, 3)); //Font Size Modifier temp.fontStyle = System.Convert.ToInt32(lineInput.Substring(4, 1)); //Font Style Modifier if (lineInput.Length >= 6) //prevent substring out of range error { temp.fontFace = lineInput.Substring(6); //Font FACE Modifier - takes a string until end of line. Can be absent } caseNum++; } else { Debug.Log("Syntax Error on Info Line 2"); status = "FAIL - Syntax Error"; } break; case 3: //Final Info line: Stop and comment if (lineInput.Length >= 1) { temp.stop = System.Convert.ToInt32(lineInput.Substring(0, 1)); //Font Style Modifier /* * Use something like this to include Comment with the Line class. * Currently: Not implemented. * if (lineInput.Length >= 6)//prevent substring out of range error * temp.fontFace = lineInput.Substring(6);//Font FACE Modifier - takes a string until end of line. Can be absent */ caseNum++; } else { Debug.Log("Syntax Error on Info Line 3"); status = "FAIL - Syntax Error"; } break; case 4: //The text of a line. Unless we get to seperator, don't add line. //Keep adding to Details until we get to seperator if (lineInput == seperator) //once we get to seperator, dump detailsTemp into details list and then continue switching { //idk, but I don't think this is needed: lines.Add((linesTemp + "\n")); //should add a newline between lines in the text file Lines.Add(temp); //Add temp to lines temp = new Line(); //Resets temp //Does a cool thing while reading if (Lines.Count % 3 > 0) { Debug.Log("Line read successfully."); } else if (Lines.Count % 3 > 1) { Debug.Log("Line read successfully.."); } else { Debug.Log("Line read successfully..."); } //Even cooler: TODO Make it so that for each line read, one more dot appears caseNum++; } else { temp.line += lineInput; //adds lines to details temp until we get to seperator temp.line += "\n"; } break; } } } //Success Debug.Log("Load complete! " + fileName); Debug.Log("Lines: " + Lines.Count); //ListViewRefresh(); //Only needed in McDialogue PArser //If this contains only one line, set lastline = true if (Lines.Count == 1) { lastLine = true; oneLine = true; //Prevents InputMan from setting lastLine to false } else { oneLine = false; } //Now, output first line currentLine = -1; NextLine(); } else { Debug.Log("File not found: " + fileName); } } catch (System.Exception ex) { Debug.Log("Error while loading file.\n" + ex.Message); } } ///END OF WINDOWS SECTION ///BEGIN NON-WINDOWS SECTION else if (Resources.Load(fileName) != null) { Debug.Log("Trying to load using Resources.Load..."); var thisFile = Resources.Load(fileName); Debug.Log(thisFile.GetType()); string[] textInput = File.ReadAllLines(thisFile.ToString());//read whole file //Clear the set of lines, so we don't read from the beginning again. Lines.Clear(); int caseNum = 0; string status = "working"; Line temp = new Line(); //to hold info, before it's added to Lines //Now slice it into bitty bits! foreach (string lineInput in textInput) { if (status == "working") { switch (caseNum % 5) //casenum keeps counting up, and we use it mod 5 { case 0: //Name of speaker //If line has 1+ characters (Because saved files tend to have an empty line at end if (lineInput.Length > 0) { temp.speaker = lineInput; //Also add it to the dropdown list if not already on it //AddToCharBox(lineInput); //McDialogue Tool Only } else { Debug.Log("Blank Name Detected"); } //No error for name being blank, in the event of narration or something. ///Seems like a dumb idea, but I can change it later. caseNum++; break; case 1: //Info line 1: Anim, sound, sprite if (lineInput.Length >= 7) { //anim string raw = lineInput.Substring(0, 2); //Substring: (starting position, count) temp.anim = System.Convert.ToInt32(raw); //using System temp.sound = System.Convert.ToInt32(lineInput.Substring(3, 2)); //sound temp.sprite = System.Convert.ToInt32(lineInput.Substring(6, 2)); //sprite caseNum++; } else { Debug.Log("Syntax Error on Info Line 1"); status = "FAIL - Syntax Error"; } break; case 2: //Info line 2 - Size, style, font-face if (lineInput.Length >= 5) { temp.size = System.Convert.ToInt32(lineInput.Substring(0, 3)); //Font Size Modifier temp.fontStyle = System.Convert.ToInt32(lineInput.Substring(4, 1)); //Font Style Modifier if (lineInput.Length >= 6) //prevent substring out of range error { temp.fontFace = lineInput.Substring(6); //Font FACE Modifier - takes a string until end of line. Can be absent } caseNum++; } else { Debug.Log("Syntax Error on Info Line 2"); status = "FAIL - Syntax Error"; } break; case 3: //Final Info line: Stop and comment if (lineInput.Length >= 1) { temp.stop = System.Convert.ToInt32(lineInput.Substring(0, 1)); //Font Style Modifier /* * Use something like this to include Comment with the Line class. * Currently: Not implemented. * if (lineInput.Length >= 6)//prevent substring out of range error * temp.fontFace = lineInput.Substring(6);//Font FACE Modifier - takes a string until end of line. Can be absent */ caseNum++; } else { Debug.Log("Syntax Error on Info Line 3"); status = "FAIL - Syntax Error"; } break; case 4: //The text of a line. Unless we get to seperator, don't add line. //Keep adding to Details until we get to seperator if (lineInput == seperator) //once we get to seperator, dump detailsTemp into details list and then continue switching { //idk, but I don't think this is needed: lines.Add((linesTemp + "\n")); //should add a newline between lines in the text file Lines.Add(temp); //Add temp to lines temp = new Line(); //Resets temp //Does a cool thing while reading if (Lines.Count % 3 > 0) { Debug.Log("Line read successfully."); } else if (Lines.Count % 3 > 1) { Debug.Log("Line read successfully.."); } else { Debug.Log("Line read successfully..."); } //Even cooler: TODO Make it so that for each line read, one more dot appears caseNum++; } else { temp.line += lineInput; //adds lines to details temp until we get to seperator temp.line += "\n"; } break; } } } //Success Debug.Log("Load complete! " + fileName); Debug.Log("Lines: " + Lines.Count); //ListViewRefresh(); //Only needed in McDialogue PArser //If this contains only one line, set lastline = true if (Lines.Count == 1) { lastLine = true; oneLine = true; //Prevents InputMan from setting lastLine to false } else { oneLine = false; } //Now, output first line currentLine = -1; NextLine(); } else { Debug.Log("Both load methods failed"); } }
void ApplyWatermark(SourceMedia sourceMedia, TargetMedia targetMedia, TrimConfig trimConfig, TransformationState transformationState) { if (targetMedia.targetFile.Exists()) { targetMedia.targetFile.Delete(); } transformationState.requestId = UUID.RandomUUID().ToString(); /* MediaTransformationListener transformationListener = new MediaTransformationListener(this, transformationState.requestId, transformationState, targetMedia); */ var resourceId = Resource.Drawable.test_image_1; var watermarkUri = new Uri.Builder() .Scheme(ContentResolver.SchemeAndroidResource) .Authority(Resources.GetResourcePackageName(resourceId)) .AppendPath(Resources.GetResourceTypeName(resourceId)) .AppendPath(Resources.GetResourceEntryName(resourceId)) .Build(); List<IGlFilter> watermarkImageFilter = null; foreach (TargetTrack targetTrack in targetMedia.tracks) { if (targetTrack is TargetVideoTrack targetVideoTrack) { targetVideoTrack.overlay = watermarkUri; watermarkImageFilter = createGlFilters( sourceMedia, (TargetVideoTrack)targetTrack, 0.2f, new PointF(0.8f, 0.8f), 0); break; } } MediaRange mediaRange = trimConfig.enabled ? new MediaRange( TimeUnit.Milliseconds.ToMicros((long)(trimConfig.range[0] * 1000)), TimeUnit.Milliseconds.ToMicros((long)(trimConfig.range[1] * 1000))) : new MediaRange(0, long.MaxValue); TransformationOptions transformationOptions = new TransformationOptions.Builder() .SetGranularity(MediaTransformer.GranularityDefault) .SetVideoFilters(watermarkImageFilter) .SetSourceMediaRange(mediaRange) .Build(); _mediaTransformer.Transform( _transformationState.requestId, _sourceMedia.uri, targetMedia.targetFile.Path, null, null, this, transformationOptions); }
private void createFormField(FormField formField) { GameObject layerInput = null; UnityEngine.Object terrainInputPrefab; switch (formField.Type) { case FormFieldType.Check: terrainInputPrefab = Resources.Load("Prefabs/TerrainInputFieldCheck", typeof(GameObject)); layerInput = (GameObject)Instantiate(terrainInputPrefab); layerInput.GetComponentInChildren <Text>().text = formField.Title; layerInput.GetComponentInChildren <Toggle>().isOn = ((FormFieldCheck)formField).Value; break; case FormFieldType.Integer: terrainInputPrefab = Resources.Load("Prefabs/TerrainInputFieldInteger", typeof(GameObject)); layerInput = (GameObject)Instantiate(terrainInputPrefab); layerInput.GetComponentsInChildren <Text>()[0].text = formField.Title; layerInput.GetComponentsInChildren <Text>()[1].text = "" + ((FormFieldInteger)formField).Value; layerInput.GetComponentsInChildren <Text>()[2].text = "" + ((FormFieldInteger)formField).Value; layerInput.GetComponentInChildren <InputField>().text = "" + ((FormFieldInteger)formField).Value; break; case FormFieldType.Number: terrainInputPrefab = Resources.Load("Prefabs/TerrainInputFieldNumber", typeof(GameObject)); layerInput = (GameObject)Instantiate(terrainInputPrefab); layerInput.GetComponentsInChildren <Text>()[0].text = formField.Title; layerInput.GetComponentsInChildren <Text>()[1].text = "" + ((FormFieldNumber)formField).Value; layerInput.GetComponentsInChildren <Text>()[2].text = "" + ((FormFieldNumber)formField).Value; layerInput.GetComponentInChildren <InputField>().text = "" + ((FormFieldNumber)formField).Value; break; case FormFieldType.Options: terrainInputPrefab = Resources.Load("Prefabs/TerrainInputFieldOptions", typeof(GameObject)); layerInput = (GameObject)Instantiate(terrainInputPrefab); List <Dropdown.OptionData> options = new List <Dropdown.OptionData>(); foreach (string optionStr in ((FormFieldOptions)formField).Options) { options.Add(new Dropdown.OptionData(optionStr)); } layerInput.GetComponentInChildren <Dropdown>().options.Clear(); layerInput.GetComponentInChildren <Dropdown>().AddOptions(options); layerInput.GetComponentInChildren <Dropdown>().value = ((FormFieldOptions)formField).Value; layerInput.GetComponentInChildren <Text>().text = formField.Title; break; case FormFieldType.Text: terrainInputPrefab = Resources.Load("Prefabs/TerrainInputFieldText", typeof(GameObject)); layerInput = (GameObject)Instantiate(terrainInputPrefab); layerInput.GetComponentsInChildren <Text>()[0].text = formField.Title; layerInput.GetComponentsInChildren <Text>()[1].text = "" + ((FormFieldText)formField).Value; layerInput.GetComponentsInChildren <Text>()[2].text = "" + ((FormFieldText)formField).Value; layerInput.GetComponentInChildren <InputField>().text = "" + ((FormFieldText)formField).Value; break; } formFieldObjects.Add(formField, layerInput); layerInput.transform.SetParent(gameObject.transform, false); }
void Awake() { audioC = GetComponent <AudioController>(); bilder = GetComponent <Builder>(); //ステージの取得 stage = Resources.Load <GameObject>("StagePrefab/" + stageNumber.ToString()); //プレイヤーの取得 player = GameObject.FindGameObjectWithTag("Player"); playerScript = player.GetComponent <PlayerMove>(); foreach (Transform child in player.transform) { if (child.gameObject.tag == "Cable") { cable = child.gameObject.GetComponent <Cable>(); break; } } //ステージの生成 instansStage = Instantiate(stage); //スカイボックスをステージに合わせる RenderSettings.skybox = Resources.Load <Material>(SKYBOX_PATH + stageNumber.ToString()); foreach (Transform child in instansStage.transform) { if (child.gameObject.tag == "GimmickParent") { cable.gimmickParent = child.gameObject; } } //ビルダーにステージ情報を送る bilder.stage = instansStage; xBox = GetComponent <XBox>(); //プレイヤーの初期位置の設定 foreach (Transform child in instansStage.transform) { if (child.gameObject.tag == "StartPosition") { startPosition = child.transform.position; player.transform.position = startPosition; player.transform.eulerAngles = child.transform.eulerAngles; } } //キャンバスの取得 canvas = GameObject.FindGameObjectWithTag("Canvas"); foreach (Transform child in canvas.transform) { if (child.gameObject.name == "Pause") { //ポーズ画面の取得 pauseUi = child.gameObject.GetComponent <RawImage>(); } //ブラックアウト用の画像の取得 if (child.gameObject.name == "BlackOut") { blackBack = child.gameObject.GetComponent <Image>(); } } //ポーズ画面の取得 +1はHelp画面を入れる images = new Texture[Enum.GetValues(typeof(PouseMode)).Length + 1]; for (int i = 0; i < Enum.GetValues(typeof(PouseMode)).Length; i++) { PouseMode pm = (PouseMode)i; images[i] = Resources.Load <Texture>(POUSE_PATH + pm.ToString()); } images[images.Length - 1] = Resources.Load <Texture>("Image/Help"); //黒から透明に BlackOutAlpha(false, 1f, true, Color.black, BlackOutTime); //ステージにあったBGMの再生 AudioController.Bgm bgm = (AudioController.Bgm)Enum.Parse(typeof(AudioController.Bgm), stageNumber.ToString() + "_Bgm"); audioC.BgmSoundPlay(bgm); }
public void ParseMultipleCallbacksWithReferenceShouldSucceed() { using (var stream = Resources.GetStream(Path.Combine(SampleFolderPath, "multipleCallbacksWithReference.yaml"))) { // Act var openApiDoc = new OpenApiStreamReader().Read(stream, out var diagnostic); // Assert var path = openApiDoc.Paths.First().Value; var subscribeOperation = path.Operations[OperationType.Post]; diagnostic.Should().BeEquivalentTo( new OpenApiDiagnostic() { SpecificationVersion = OpenApiSpecVersion.OpenApi3_0 }); var callback1 = subscribeOperation.Callbacks["simpleHook"]; callback1.Should().BeEquivalentTo( new OpenApiCallback { PathItems = { [RuntimeExpression.Build("$request.body#/url")] = new OpenApiPathItem { Operations = { [OperationType.Post] = new OpenApiOperation() { RequestBody = new OpenApiRequestBody { Content = { ["application/json"] = new OpenApiMediaType { Schema = new OpenApiSchema() { Type = "object" } } } }, Responses = { ["200"] = new OpenApiResponse { Description = "Success" } } } } } }, Reference = new OpenApiReference { Type = ReferenceType.Callback, Id = "simpleHook", } }); var callback2 = subscribeOperation.Callbacks["callback2"]; callback2.Should().BeEquivalentTo( new OpenApiCallback { PathItems = { [RuntimeExpression.Build("/simplePath")] = new OpenApiPathItem { Operations = { [OperationType.Post] = new OpenApiOperation() { RequestBody = new OpenApiRequestBody { Description = "Callback 2", Content = { ["application/json"] = new OpenApiMediaType { Schema = new OpenApiSchema() { Type = "string" } } } }, Responses = { ["400"] = new OpenApiResponse { Description = "Callback Response" } } } }, } } }); var callback3 = subscribeOperation.Callbacks["callback3"]; callback3.Should().BeEquivalentTo( new OpenApiCallback { PathItems = { [RuntimeExpression.Build(@"http://example.com?transactionId={$request.body#/id}&email={$request.body#/email}")] = new OpenApiPathItem { Operations = { [OperationType.Post] = new OpenApiOperation() { RequestBody = new OpenApiRequestBody { Content = { ["application/xml"] = new OpenApiMediaType { Schema = new OpenApiSchema() { Type = "object" } } } }, Responses = { ["200"] = new OpenApiResponse { Description = "Success" }, ["401"] = new OpenApiResponse { Description = "Unauthorized" }, ["404"] = new OpenApiResponse { Description = "Not Found" } } } } } } }); } }
void Start() { darkMap = GameObject.Find("DarkMap"); spawnMeteors = GameObject.Find("SpawnMeteors"); colorSelection = SceneSelection.MateralSelection; Material[] materials = new Material[marbleCount]; switch (colorSelection) { case 0: materials[0] = Resources.Load <Material>("Light Blue"); materials[1] = Resources.Load <Material>("Purple"); materials[2] = Resources.Load <Material>("Red"); materials[3] = Resources.Load <Material>("Yellow"); break; case 1: materials[0] = Resources.Load <Material>("Pink"); materials[1] = Resources.Load <Material>("Purple"); materials[2] = Resources.Load <Material>("Green"); materials[3] = Resources.Load <Material>("Orange"); break; case 2: materials[0] = Resources.Load <Material>("Dark Blue"); materials[1] = Resources.Load <Material>("Blue"); materials[2] = Resources.Load <Material>("Orange"); materials[3] = Resources.Load <Material>("Red"); break; case 3: materials[0] = Resources.Load <Material>("Earth"); materials[1] = Resources.Load <Material>("Moon"); materials[2] = Resources.Load <Material>("Mars"); materials[3] = Resources.Load <Material>("Pluto"); break; case 4: materials = RandomMarbles(); break; default: materials[0] = Resources.Load <Material>("Blue"); materials[1] = Resources.Load <Material>("Purple"); materials[2] = Resources.Load <Material>("Red"); materials[3] = Resources.Load <Material>("Yellow"); break; } // Create a bunch of random marbles with labels. marbles = new List <GameObject>(); marbleLabels = new List <GameObject>(); for (int x = 0; x < marbleCount; x++) { string marbleName = materials[x].name; // Create the marble prefab.GetComponent <Renderer>().material = materials[x]; Vector3 spawnVector = new Vector3(Random.Range(-2f, 2f), x, Random.Range(-2f, 2f)); marbles.Add(Instantiate(prefab, this.transform.position + spawnVector, Quaternion.identity)); marbles[x].name = marbleName; // Add trails to marbles TrailRenderer trail = marbles[x].AddComponent <TrailRenderer>(); trail.time = 0.25f; trail.material = marbles[x].GetComponent <MeshRenderer>().material; AnimationCurve curve = new AnimationCurve(); curve.AddKey(0.0f, 0.75f); curve.AddKey(0.6f, 0.25f); curve.AddKey(1.0f, 0.0f); trail.widthCurve = curve; // If the map is dark, make the marbles glow // In order to use this, an empty GameObject named "DarkMap" must be added to the scene. if (darkMap != null) { Light marbleGlow = marbles[x].AddComponent <Light>(); marbleGlow.color = materials[x].color; marbleGlow.intensity *= 5; } // Rolling sound for marbles (only plays if they are touching a surface) // Add external script to each marble for collisions marbles[x].AddComponent <RollingSound>(); marbles[x].AddComponent <AudioSource>(); AudioSource audio = marbles[x].GetComponent <AudioSource>(); AudioClip newClip = Resources.Load <AudioClip>("Roll"); Debug.Log(newClip); audio.clip = newClip; audio.playOnAwake = true; audio.loop = true; audio.spatialBlend = 1; audio.rolloffMode = AudioRolloffMode.Linear; audio.maxDistance = 50; audio.volume = 0.75f; // Create the marble label GameObject labelPrefab = Resources.Load <GameObject>("Label"); GameObject label = Instantiate(labelPrefab, marbles[x].transform.position, Quaternion.identity, marbles[x].transform) as GameObject; label.name = marbleName + " Label"; label.tag = "marbleNotFinished"; // Set the label text TextMeshPro labelText = label.GetComponent <TextMeshPro>(); labelText.text = marbleName; labelText.fontSize = 14; labelText.color = Color.white; labelText.alignment = TextAlignmentOptions.Center; labelText.outlineColor = Color.black; labelText.outlineWidth = 0.2f; labelText.fontStyle = FontStyles.Bold; //label.transform.position = marbles[x].transform.position; marbleLabels.Add(label); } // This spawns meteors, but it DESTROYS the framerate if (spawnMeteors != null) { meteors = new List <GameObject>(); for (int x = 0; x < 20; x++) { GameObject meteor = (GameObject)Resources.Load("meteor"); meteors.Add(Instantiate(meteor)); } } // Initialize scoreboard scoreboard = new Scoreboard(); foreach (GameObject marble in marbles) { scoreboard.AddMarble(marble); } scoreboard.Create(); }
protected virtual void Start() { Init(); damagePopup = (GameObject)Resources.Load("Prefabs/Common/UI/DamagePopup", typeof(GameObject)); }
// Use this for initialization void Start () { btnClip = Resources.Load("btnDown") as AudioClip; }
void Start() { prefab = Resources.Load("ShootBall") as GameObject; }
public override void InitPlanet() { nbParticulePlayer = 0; nbParticuleEnemy = 0; type = GV.PLANET_TYPE.NEUTRAL; lvl = 1; capacity = lvl * GV.PLANET_MAX_PARTICULE_PER_LEVEL; currentHealth = 0; position = gameObject.transform; material = Resources.Load <Material>("Materials\\NeutralPlanet"); size = lvl; //if the planet are static object they will not change when the game run gameObject.transform.localScale = new Vector3(size, size, size); //Init Health //Update Helath Bar UpdateHealth(healthBarTransform, currentHealth, maxLevel * GV.PLANET_MAX_PARTICULE_PER_LEVEL, Resources.Load <Material>(GV.NEUTRAL_PLANET_MATERIAL)); }
// Load the cards up. public void loadCards(List<Card> cards, GameObject area){ Card currCard; // Create Card GameObject's. for(int i = 0 ; i < cards.Count; i++){ currCard = cards[i]; area.GetComponent<CardArea>().addCard(currCard); GameObject CardUI = null; // TODO: Clean this up. if (currCard.GetType () == typeof(WeaponCard)) { WeaponCard currWeapon = (WeaponCard)currCard; CardUI = Instantiate (WeaponCard); CardUI.GetComponent<WeaponCard>().name = currWeapon.name; CardUI.GetComponent<WeaponCard>().asset = currWeapon.asset; CardUI.GetComponent<WeaponCard>().power = currWeapon.power; } else if (currCard.GetType () == typeof(FoeCard)) { FoeCard currFoe = (FoeCard)currCard; CardUI = Instantiate (FoeCard); CardUI.GetComponent<FoeCard>().name = currFoe.name; CardUI.GetComponent<FoeCard>().type = currFoe.type; CardUI.GetComponent<FoeCard>().loPower = currFoe.loPower; CardUI.GetComponent<FoeCard>().hiPower = currFoe.hiPower; CardUI.GetComponent<FoeCard>().special = currFoe.special; CardUI.GetComponent<FoeCard>().asset = currFoe.asset; } else if (currCard.GetType () == typeof(AllyCard)) { AllyCard currAlly = (AllyCard)currCard; CardUI = Instantiate (AllyCard); CardUI.GetComponent<AllyCard>().name = currAlly.name; CardUI.GetComponent<AllyCard>().asset = currAlly.asset; CardUI.GetComponent<AllyCard>().special = currAlly.special; CardUI.GetComponent<AllyCard>().power = currAlly.power; CardUI.GetComponent<AllyCard>().bid = currAlly.bid; CardUI.GetComponent<AllyCard>().bonusPower = currAlly.bonusPower; CardUI.GetComponent<AllyCard>().bonusBid = currAlly.bonusBid; CardUI.GetComponent<AllyCard>().questCondition = currAlly.questCondition; CardUI.GetComponent<AllyCard>().allyCondition = currAlly.allyCondition; } else if(currCard.GetType () == typeof(AmourCard)) { AmourCard currAmour = (AmourCard)currCard; CardUI = Instantiate (AmourCard); CardUI.GetComponent<AmourCard>().name = currAmour.name; CardUI.GetComponent<AmourCard>().asset = currAmour.asset; CardUI.GetComponent<AmourCard>().power = currAmour.power; CardUI.GetComponent<AmourCard>().bid = currAmour.bid; } else if(currCard.GetType () == typeof(TestCard)){ TestCard currTest = (TestCard)currCard; CardUI = Instantiate (TestCard); CardUI.GetComponent<TestCard>().name = currTest.name; CardUI.GetComponent<TestCard>().asset = currTest.asset; CardUI.GetComponent<TestCard>().minBids = currTest.minBids; } // Load the card sprite. Sprite card = Resources.Load<Sprite>(currCard.asset); CardUI.gameObject.GetComponent<Image>().sprite = card; CardUI.transform.SetParent(area.transform); // Set the cards obj to it's UI. currCard.obj = CardUI; } }
private void OnEnable() { windowSkin = Resources.Load("ContentSkin") as GUISkin; headerSkin = Resources.Load("HeaderSkin") as GUISkin; }
//REnables the UI for the reload menu public void showReloadScreen() { //resets the bottle indicators of bullet number foreach (GameObject g in bulletIndicators) { g.SetActive(true); } //resets the default staus to the rune holding ui for (int i = 0; i < spellSlots.Count; i++) { spellSlots[i].GetComponent <Image>().sprite = defaultSlot; spellSlots[i].GetComponent <Image>().color = Color.white; } //removes the bullets used in the last round from the deck for (int i = Temp.Count - 1; i > -1; i--) { if (Temp [i] != null) { Temp.RemoveAt(i); } if (TempNum [i] != null) { Handful.RemoveAt(TempNum [i]); TempNum.RemoveAt(i); } } //reenables the UI for the reload screen for (int i = 0; i < pauseObjects.Length; i++) { if (i < Handful.Count) { pauseObjects [i].SetActive(true); } else { pauseObjects [pauseObjects.Length - 1].SetActive(true); } } //DEactivates the UI for the battle screen for (int i = 0; i < battleObjects.Length; i++) { if (battleObjects[i] != null) { battleObjects [i].SetActive(false); } } //reenables the UI for the reload screen for (int i = 0; i < pauseUI.Length; i++) { pauseUI [i].SetActive(true); } //Selects the proper button selectButton(); pause = true; //Sets each spell holder to a match the spell from the deck. for (int i = 0; i < spellHold.children.Count; i++) { Button b = spellHold.children [i].gameObject.GetComponent <Button> (); int currentHolder = i; b.onClick.RemoveAllListeners(); b.onClick.AddListener(delegate { addBullet(currentHolder); }); if (Handful.Count > i) { GameObject curSpell = ((GameObject)Resources.Load(Handful [i].name)); curSpell.GetComponent <Spell> ().setDescription(player.weapon); b.GetComponent <Image> ().sprite = curSpell.GetComponent <Spell> ().bulletImage; if (b.GetComponent <Image> ().sprite.name == "Knob") { b.GetComponent <Image> ().color = curSpell.GetComponent <SpriteRenderer> ().color; } else { b.GetComponent <Image> ().color = Color.white; } RuneInfo r = spellHold.children [i].gameObject.GetComponent <RuneInfo> (); r.runeName = curSpell.GetComponent <Spell>().name; r.runeImage = curSpell.GetComponent <Spell> ().runeImage; r.runeDesc = curSpell.GetComponent <Spell> ().description; r.runeDamage = curSpell.GetComponent <Spell>().damage.ToString(); } } //Sets the player's reload value to false preventing it from reactivating the reload screen immediately player.reload = false; }
public override void OnInspectorGUI() { m_object.Update(); DrawDefaultInspector(); _2dxFX_AL_SkyCloud _2dxScript = (_2dxFX_AL_SkyCloud)target; Texture2D icon = Resources.Load ("2dxfxinspector-al") as Texture2D; if (icon) { Rect r; float ih=icon.height; float iw=icon.width; float result=ih/iw; float w=Screen.width; result=result*w; r = GUILayoutUtility.GetRect(ih, result); EditorGUI.DrawTextureTransparent(r,icon); } EditorGUILayout.LabelField("Advanced Lightning may work on mobile high-end devices and may be slower than the Standard 2DxFX effects due to is lightning system. Use it only if you need it.", EditorStyles.helpBox); EditorGUILayout.PropertyField(m_object.FindProperty("AddShadow"), new GUIContent("Add Shadow", "Use a unique material, reduce drastically the use of draw call")); if (_2dxScript.AddShadow) { EditorGUILayout.PropertyField(m_object.FindProperty("ReceivedShadow"), new GUIContent("Received Shadow : No Transparency and Use Z Buffering instead of Sprite Order Layers", "Received Shadow, No Transparency and Use Z Buffering instead of Sprite Order Layers")); if (_2dxScript.ReceivedShadow) { EditorGUILayout.LabelField("Note 1: Blend Fusion work but without transparency\n", EditorStyles.helpBox); } } // Mode Blend string BlendMethode = "Normal"; if (_2dxScript.BlendMode == 0) BlendMethode = "Normal"; if (_2dxScript.BlendMode == 1) BlendMethode = "Additive"; if (_2dxScript.BlendMode == 2) BlendMethode = "Darken"; if (_2dxScript.BlendMode == 3) BlendMethode = "Lighten"; if (_2dxScript.BlendMode == 4) BlendMethode = "Linear Burn"; if (_2dxScript.BlendMode == 5) BlendMethode = "Linear Dodge"; if (_2dxScript.BlendMode == 6) BlendMethode = "Multiply"; if (_2dxScript.BlendMode == 7) BlendMethode = "Soft Aditive"; if (_2dxScript.BlendMode == 8) BlendMethode = "2x Multiplicative"; EditorGUILayout.PropertyField(m_object.FindProperty("ForceMaterial"), new GUIContent("Shared Material", "Use a unique material, reduce drastically the use of draw call")); if (_2dxScript.ForceMaterial == null) { _2dxScript.ActiveChange = true; } else { if(GUILayout.Button("Remove Shared Material")) { _2dxScript.ForceMaterial= null; _2dxScript.ShaderChange = 1; _2dxScript.ActiveChange = true; _2dxScript.CallUpdate(); } EditorGUILayout.PropertyField (m_object.FindProperty ("ActiveChange"), new GUIContent ("Change Material Property", "Change The Material Property")); } if (_2dxScript.ActiveChange) { EditorGUILayout.BeginVertical("Box"); Texture2D icone = Resources.Load ("2dxfx-icon-size_x") as Texture2D; EditorGUILayout.PropertyField(m_object.FindProperty("_OffsetX"), new GUIContent("Offset X", icone, "Change the start offset of the shadow effect")); icone = Resources.Load ("2dxfx-icon-size_y") as Texture2D; EditorGUILayout.PropertyField(m_object.FindProperty("_OffsetY"), new GUIContent("Offset Y", icone, "Change the start offset of the shadow effect")); icone = Resources.Load ("2dxfx-icon-size") as Texture2D; EditorGUILayout.PropertyField(m_object.FindProperty("_Zoom"), new GUIContent("Zoom", icone, "Zoom the shadow effect")); icone = Resources.Load ("2dxfx-icon-value") as Texture2D; EditorGUILayout.PropertyField(m_object.FindProperty("_Intensity"), new GUIContent("Intensity", icone, "Active the X mouvement of the cloud")); icone = Resources.Load ("2dxfx-icon-value") as Texture2D; EditorGUILayout.PropertyField(m_object.FindProperty("_AutoScrollX"), new GUIContent("Auto Scroll X", icone, "Change the value of the posterize effect")); if (_2dxScript._AutoScrollX) { icone = Resources.Load ("2dxfx-icon-time") as Texture2D; EditorGUILayout.PropertyField(m_object.FindProperty("_AutoScrollSpeedX"), new GUIContent("Auto Scroll Speed X", icone, "Change the speed of the shadow")); } icone = Resources.Load ("2dxfx-icon-value") as Texture2D; EditorGUILayout.PropertyField(m_object.FindProperty("_AutoScrollY"), new GUIContent("Auto Scroll Y", icone, "Active the Y mouvement of the cloud")); if (_2dxScript._AutoScrollY) { icone = Resources.Load ("2dxfx-icon-time") as Texture2D; EditorGUILayout.PropertyField(m_object.FindProperty("_AutoScrollSpeedY"), new GUIContent("Auto Scroll Speed Y", icone, "Change the speed of the shadow")); } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical("Box"); icone = Resources.Load ("2dxfx-icon-fade") as Texture2D; EditorGUILayout.PropertyField(m_object.FindProperty("_Alpha"), new GUIContent("Fading", icone, "Fade from nothing to showing")); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical("Box"); EditorGUILayout.LabelField("Change Blend Fusion = " + BlendMethode, EditorStyles.whiteLargeLabel); if (_2dxScript.ReceivedShadow) { EditorGUILayout.LabelField("Note: Blend Fusion is not working correctly with Received Shadow", EditorStyles.helpBox); } EditorGUILayout.BeginHorizontal("Box"); if (GUILayout.Button("Normal", EditorStyles.toolbarButton)) { _2dxScript.BlendMode = 0; _2dxScript.CallUpdate(); } if (GUILayout.Button("Additive", EditorStyles.toolbarButton)) { _2dxScript.BlendMode = 1; _2dxScript.CallUpdate(); } if (GUILayout.Button("Darken", EditorStyles.toolbarButton)) { _2dxScript.BlendMode = 2; _2dxScript.CallUpdate(); } if (GUILayout.Button("Lighten", EditorStyles.toolbarButton)) { _2dxScript.BlendMode = 3; _2dxScript.CallUpdate(); } if (GUILayout.Button("Linear Burn", EditorStyles.toolbarButton)) { _2dxScript.BlendMode = 4; _2dxScript.CallUpdate(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal("Box"); if (GUILayout.Button("Linear Dodge", EditorStyles.toolbarButton)) { _2dxScript.BlendMode = 5; _2dxScript.CallUpdate(); } if (GUILayout.Button("Multiply", EditorStyles.toolbarButton)) { _2dxScript.BlendMode = 6; _2dxScript.CallUpdate(); } if (GUILayout.Button("Soft Aditive", EditorStyles.toolbarButton)) { _2dxScript.BlendMode = 7; _2dxScript.CallUpdate(); } if (GUILayout.Button("2x Multiplicative", EditorStyles.toolbarButton)) { _2dxScript.BlendMode = 8; _2dxScript.CallUpdate(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); } m_object.ApplyModifiedProperties(); }
void Update() { if (this.gameObject.GetComponent<Image> () != null) { if (CanvasImage==null) CanvasImage = this.gameObject.GetComponent<Image> (); } if ((ShaderChange == 0) && (ForceMaterial != null)) { ShaderChange=1; if (tempMaterial!=null) DestroyImmediate(tempMaterial); if(this.gameObject.GetComponent<SpriteRenderer>() != null) { this.GetComponent<Renderer>().sharedMaterial = ForceMaterial; } else if(this.gameObject.GetComponent<Image>() != null) { CanvasImage.material = ForceMaterial; } ForceMaterial.hideFlags = HideFlags.None; ForceMaterial.shader=Shader.Find(shader); } if ((ForceMaterial == null) && (ShaderChange==1)) { if (tempMaterial!=null) DestroyImmediate(tempMaterial); tempMaterial = new Material(Shader.Find(shader)); tempMaterial.hideFlags = HideFlags.None; if(this.gameObject.GetComponent<SpriteRenderer>() != null) { this.GetComponent<Renderer>().sharedMaterial = tempMaterial; } else if(this.gameObject.GetComponent<Image>() != null) { CanvasImage.material = tempMaterial; } ShaderChange=0; } #if UNITY_EDITOR string dfname = ""; if(this.gameObject.GetComponent<SpriteRenderer>() != null) dfname=this.GetComponent<Renderer>().sharedMaterial.shader.name; if(this.gameObject.GetComponent<Image>() != null) { Image img = this.gameObject.GetComponent<Image>(); if (img.material==null) dfname="Sprites/Default"; } if (dfname == "Sprites/Default") { ForceMaterial.shader=Shader.Find(shader); ForceMaterial.hideFlags = HideFlags.None; if(this.gameObject.GetComponent<SpriteRenderer>() != null) { this.GetComponent<Renderer>().sharedMaterial = ForceMaterial; } else if(this.gameObject.GetComponent<Image>() != null) { Image img = this.gameObject.GetComponent<Image>(); if (img.material==null) CanvasImage.material = ForceMaterial; } __MainTex2 = Resources.Load ("_2dxFX_ShadowTXT") as Texture2D; if(this.gameObject.GetComponent<SpriteRenderer>() != null) { this.GetComponent<Renderer>().sharedMaterial.SetTexture ("_MainTex2", __MainTex2); } else if(this.gameObject.GetComponent<Image>() != null) { Image img = this.gameObject.GetComponent<Image>(); if (img.material==null) CanvasImage.material.SetTexture ("_MainTex2", __MainTex2); } } #endif if (ActiveChange) { if(this.gameObject.GetComponent<SpriteRenderer>() != null) { this.GetComponent<Renderer>().sharedMaterial.SetFloat("_Alpha", 1-_Alpha); if (_2DxFX.ActiveShadow && AddShadow) { this.GetComponent<Renderer>().shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On; if (ReceivedShadow) { this.GetComponent<Renderer>().receiveShadows = true; this.GetComponent<Renderer>().sharedMaterial.renderQueue = 2450; this.GetComponent<Renderer>().sharedMaterial.SetInt("_Z", 1); } else { this.GetComponent<Renderer>().receiveShadows = false; this.GetComponent<Renderer>().sharedMaterial.renderQueue = 3000; this.GetComponent<Renderer>().sharedMaterial.SetInt("_Z", 0); } } else { this.GetComponent<Renderer>().shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off; this.GetComponent<Renderer>().receiveShadows = false; this.GetComponent<Renderer>().sharedMaterial.renderQueue = 3000; this.GetComponent<Renderer>().sharedMaterial.SetInt("_Z", 0); } if (BlendMode == 0) // Normal { this.GetComponent<Renderer>().sharedMaterial.SetInt("_BlendOp", (int)UnityEngine.Rendering.BlendOp.Add); this.GetComponent<Renderer>().sharedMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One); this.GetComponent<Renderer>().sharedMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha); } if (BlendMode == 1) // Additive { this.GetComponent<Renderer>().sharedMaterial.SetInt("_BlendOp", (int)UnityEngine.Rendering.BlendOp.Add); this.GetComponent<Renderer>().sharedMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One); this.GetComponent<Renderer>().sharedMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.One); } if (BlendMode == 2) // Darken { this.GetComponent<Renderer>().sharedMaterial.SetInt("_BlendOp", (int)UnityEngine.Rendering.BlendOp.ReverseSubtract); this.GetComponent<Renderer>().sharedMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One); this.GetComponent<Renderer>().sharedMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.DstColor); } if (BlendMode == 3) // Lighten { this.GetComponent<Renderer>().sharedMaterial.SetInt("_BlendOp", (int)UnityEngine.Rendering.BlendOp.Max); this.GetComponent<Renderer>().sharedMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One); this.GetComponent<Renderer>().sharedMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.One); } if (BlendMode == 4) // Linear Burn { this.GetComponent<Renderer>().sharedMaterial.SetInt("_BlendOp", (int)UnityEngine.Rendering.BlendOp.ReverseSubtract); this.GetComponent<Renderer>().sharedMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One); this.GetComponent<Renderer>().sharedMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.One); } if (BlendMode == 5) // Linear Dodge { this.GetComponent<Renderer>().sharedMaterial.SetInt("_BlendOp", (int)UnityEngine.Rendering.BlendOp.Max); this.GetComponent<Renderer>().sharedMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha); this.GetComponent<Renderer>().sharedMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha); } if (BlendMode == 6) // Multiply { this.GetComponent<Renderer>().sharedMaterial.SetInt("_BlendOp", (int)UnityEngine.Rendering.BlendOp.Add); this.GetComponent<Renderer>().sharedMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.DstColor); this.GetComponent<Renderer>().sharedMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha); } if (BlendMode == 7) // Soft Aditive { this.GetComponent<Renderer>().sharedMaterial.SetInt("_BlendOp", (int)UnityEngine.Rendering.BlendOp.Add); this.GetComponent<Renderer>().sharedMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusDstColor); this.GetComponent<Renderer>().sharedMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.One); } if (BlendMode == 8) // 2x Multiplicative { this.GetComponent<Renderer>().sharedMaterial.SetInt("_BlendOp", (int)UnityEngine.Rendering.BlendOp.ReverseSubtract); this.GetComponent<Renderer>().sharedMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.DstAlpha); this.GetComponent<Renderer>().sharedMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.DstColor); } this.GetComponent<Renderer>().sharedMaterial.SetFloat("_Zoom",_Zoom); this.GetComponent<Renderer>().sharedMaterial.SetFloat("_Intensity",_Intensity); if ((_AutoScrollX == false) && (_AutoScrollY == false)) { this.GetComponent<Renderer>().sharedMaterial.SetFloat("_OffsetX",_OffsetX); this.GetComponent<Renderer>().sharedMaterial.SetFloat("_OffsetY",_OffsetY); } if ((_AutoScrollX == true) && (_AutoScrollY == false)) { _AutoScrollCountX+=_AutoScrollSpeedX*Time.deltaTime; this.GetComponent<Renderer>().sharedMaterial.SetFloat("_OffsetX",_AutoScrollCountX); this.GetComponent<Renderer>().sharedMaterial.SetFloat("_OffsetY",_OffsetY); } if ((_AutoScrollX == false) && (_AutoScrollY == true)) { _AutoScrollCountY+=_AutoScrollSpeedY*Time.deltaTime; this.GetComponent<Renderer>().sharedMaterial.SetFloat("_OffsetX",_OffsetX); this.GetComponent<Renderer>().sharedMaterial.SetFloat("_OffsetY",_AutoScrollCountY); } if ((_AutoScrollX == true) && (_AutoScrollY == true)) { _AutoScrollCountX+=_AutoScrollSpeedX*Time.deltaTime; this.GetComponent<Renderer>().sharedMaterial.SetFloat("_OffsetX",_AutoScrollCountX); _AutoScrollCountY+=_AutoScrollSpeedY*Time.deltaTime; this.GetComponent<Renderer>().sharedMaterial.SetFloat("_OffsetY",_AutoScrollCountY); } } else if(this.gameObject.GetComponent<Image>() != null) { CanvasImage.material.SetFloat("_Alpha", 1-_Alpha); CanvasImage.material.SetFloat("_Zoom",_Zoom); CanvasImage.material.SetFloat("_Intensity",_Intensity); if ((_AutoScrollX == false) && (_AutoScrollY == false)) { CanvasImage.material.SetFloat("_OffsetX",_OffsetX); CanvasImage.material.SetFloat("_OffsetY",_OffsetY); } if ((_AutoScrollX == true) && (_AutoScrollY == false)) { _AutoScrollCountX+=_AutoScrollSpeedX*Time.deltaTime; CanvasImage.material.SetFloat("_OffsetX",_AutoScrollCountX); CanvasImage.material.SetFloat("_OffsetY",_OffsetY); } if ((_AutoScrollX == false) && (_AutoScrollY == true)) { _AutoScrollCountY+=_AutoScrollSpeedY*Time.deltaTime; CanvasImage.material.SetFloat("_OffsetX",_OffsetX); CanvasImage.material.SetFloat("_OffsetY",_AutoScrollCountY); } if ((_AutoScrollX == true) && (_AutoScrollY == true)) { _AutoScrollCountX+=_AutoScrollSpeedX*Time.deltaTime; CanvasImage.material.SetFloat("_OffsetX",_AutoScrollCountX); _AutoScrollCountY+=_AutoScrollSpeedY*Time.deltaTime; CanvasImage.material.SetFloat("_OffsetY",_AutoScrollCountY); } } if (_AutoScrollCountX > 1) _AutoScrollCountX = 0; if (_AutoScrollCountX < -1) _AutoScrollCountX = 0; if (_AutoScrollCountY > 1) _AutoScrollCountY = 0; if (_AutoScrollCountY < -1) _AutoScrollCountY = 0; } }
private TextAsset csvFile; // CSVファイル // Use this for initialization void Awake() { //配列の箱の数の指定 keywords = new string[20]; questions = new string[19]; answers = new string[19, 20]; csvFile = Resources.Load("CSV/" + "SeaKeywords1") as TextAsset; /* Resouces/CSV下のCSV読み込み */ StringReader reader = new StringReader(csvFile.text); //行の指定 int height = 0; while (reader.Peek() > -1) { string line = reader.ReadLine(); string[] array = line.Split(','); //配列arrayの値の入っている箱の数 int number = array.Length; // Debug.Log (number); // Debug.Log (line); // Debug.Log (height); if (height == 0) { //配列keywordsに値の代入 for (int i = 1; i < number; i++) { keywords [i - 1] = array [i]; } } else { //配列questionsに値の代入 questions [height - 1] = array [0]; // Debug.Log (questions [height-1]); //配列answersに値の代入 for (int i = 1; i < number; i++) { if (array [i] == "〇") { answers [height - 1, i - 1] = "YES"; } else { answers [height - 1, i - 1] = "NO"; } } } //一段行を下げる height++; } // Debug.Log (keywords [0]); // Debug.Log (keywords [19]); // Debug.Log (questions[0]); // Debug.Log (questions[20]); // Debug.Log (answers[0,0]); KeyWordsDate.numberA = Random.Range(0, KeyWordsDate.keywords.Length); KeyWordsDate.numberB = Random.Range(0, KeyWordsDate.keywords.Length); }
private void Awake() { prefabModels = Resources.LoadAll <GameObject>("LevelPrefabs/") as GameObject[]; }