static int ToString(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.Color))) { UnityEngine.Color obj = (UnityEngine.Color)ToLua.ToObject(L, 1); string o = obj.ToString(); LuaDLL.lua_pushstring(L, o); return(1); } else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.Color), typeof(string))) { UnityEngine.Color obj = (UnityEngine.Color)ToLua.ToObject(L, 1); string arg0 = ToLua.ToString(L, 2); string o = obj.ToString(arg0); LuaDLL.lua_pushstring(L, o); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Color.ToString")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
// Use this for initialization void Start() { Bitmap bitmap = new Bitmap("man_ok.png"); Texture2D tex2D = new Texture2D(bitmap.Width, bitmap.Height, TextureFormat.ARGB32, false); tex2D.name = Path.GetFileNameWithoutExtension("man_ok.png"); for (int row = 0; row < bitmap.Height; row++) { for (int col = 0; col < bitmap.Width; col++) { System.Drawing.Color srcColor = bitmap.GetPixel(col, row); UnityEngine.Color tgtColor = new UnityEngine.Color(srcColor.R, srcColor.G, srcColor.B, srcColor.A); tex2D.SetPixel(col, row, tgtColor); } } renderer.material.mainTexture = tex2D; System.Drawing.Color srcColor1 = bitmap.GetPixel(100, 100); UnityEngine.Color tgtColor1 = new UnityEngine.Color(srcColor1.R, srcColor1.G, srcColor1.B, srcColor1.A); Debug.Log(tgtColor1.ToString()); Debug.Log(srcColor1.ToString()); tex2D.Apply(); // AssetDatabase.CreateFolder("", "hello"); //AssetDatabase.CreateAsset(tex2D, "dragon.asset"); }
// Use this for initialization void Start () { Bitmap bitmap = new Bitmap("man_ok.png"); Texture2D tex2D = new Texture2D(bitmap.Width, bitmap.Height, TextureFormat.ARGB32, false); tex2D.name = Path.GetFileNameWithoutExtension("man_ok.png"); for (int row = 0; row < bitmap.Height; row++) { for (int col = 0; col < bitmap.Width; col++) { System.Drawing.Color srcColor = bitmap.GetPixel(col, row); UnityEngine.Color tgtColor = new UnityEngine.Color(srcColor.R, srcColor.G, srcColor.B, srcColor.A); tex2D.SetPixel(col, row, tgtColor); } } renderer.material.mainTexture = tex2D; System.Drawing.Color srcColor1 = bitmap.GetPixel(100, 100); UnityEngine.Color tgtColor1 = new UnityEngine.Color(srcColor1.R, srcColor1.G, srcColor1.B, srcColor1.A); Debug.Log(tgtColor1.ToString()); Debug.Log(srcColor1.ToString()); tex2D.Apply(); // AssetDatabase.CreateFolder("", "hello"); //AssetDatabase.CreateAsset(tex2D, "dragon.asset"); }
void OnGUI() { GUILayout.Label("Render UVs", EditorStyles.boldLabel); pb_GUI_Utility.DrawSeparator(2, pb_Constant.ProBuilderDarkGray); GUILayout.Space(2); imageSize = (ImageSize)EditorGUILayout.EnumPopup(new GUIContent("Image Size", "The pixel size of the image to be rendered."), imageSize); hideGrid = EditorGUILayout.Toggle(new GUIContent("Hide Grid", "Hide or show the grid lines."), hideGrid); lineColor = EditorGUILayout.ColorField(new GUIContent("Line Color", "The color of the template lines."), lineColor); transparentBackground = EditorGUILayout.Toggle(new GUIContent("Transparent Background", "If true, only the template lines will be rendered, leaving the background fully transparent."), transparentBackground); GUI.enabled = !transparentBackground; backgroundColor = EditorGUILayout.ColorField(new GUIContent("Background Color", "If `TransparentBackground` is off, this will be the fill color of the image."), backgroundColor); GUI.enabled = true; if(GUILayout.Button("Save UV Template")) { EditorPrefs.SetInt(PREF_IMAGESIZE, (int)imageSize); EditorPrefs.SetString(PREF_LINECOLOR, lineColor.ToString()); EditorPrefs.SetString(PREF_BACKGROUNDCOLOR, backgroundColor.ToString()); EditorPrefs.SetBool(PREF_TRANSPARENTBACKGROUND, transparentBackground); EditorPrefs.SetBool(PREF_HIDEGRID, hideGrid); if(pb_Editor.instance == null || pb_Editor.instance.selection.Length < 1) { Debug.LogWarning("Abandoning UV render because no ProBuilder objects are selected."); this.Close(); return; } screenFunc((int)imageSize, hideGrid, lineColor, transparentBackground, backgroundColor); this.Close(); } }
public Track(Color color) { this.Scol = new SColor(color); name = "track: " + color.ToString(); }
/// <summary> /// I need to compare this way because unity optimizes comparison and sometimes is not working, /// and i don't want to work with alpha channel /// </summary> /// <param name="c1"></param> /// <param name="c2"></param> /// <returns></returns> public static bool CompareColors(Color c1, Color c2) { if((c1.r == c2.r && c1.g == c2.g && c1.b == c2.b) || c1.ToString().Equals(c2.ToString())) { return true; } return false; }
static bool Color_ToString(JSVCall vc, int argc) { int len = argc; if (len == 0) { UnityEngine.Color argThis = (UnityEngine.Color)vc.csObj; JSApi.setStringS((int)JSApi.SetType.Rval, argThis.ToString()); JSMgr.changeJSObj(vc.jsObjID, argThis); } return(true); }
static bool Color_ToString__String(JSVCall vc, int argc) { int len = argc; if (len == 1) { System.String arg0 = (System.String)JSApi.getStringS((int)JSApi.GetType.Arg); UnityEngine.Color argThis = (UnityEngine.Color)vc.csObj; JSApi.setStringS((int)JSApi.SetType.Rval, argThis.ToString(arg0)); JSMgr.changeJSObj(vc.jsObjID, argThis); } return(true); }
/*private IEnumerator LoadBundle() { WWW www = new WWW("File:///" + Application.dataPath + "/Mods/Resources/ManyFlares.assetbundle"); yield return www; AssetBundle asset = www.assetBundle; Debug.Log("Load Asset completed!"); AssetBundleRequest request = asset.LoadAssetAsync("50mmZoom.flare", typeof(Flare)); yield return request; Debug.Log("Load Asset completed!"); Flare go = request.asset as Flare; go.name = "GOOOO"; DontDestroyOnLoad(go); OkGo = true; foreach(UnityEngine.Object obj in asset.LoadAllAssets()) { Instantiate(obj); } asset.Unload(false); }*/ void Start() { //Application.LoadLevel (5); StartCoroutine(SkyBox()); Commands.RegisterHelpMessage("CLOUDS!"); Commands.RegisterCommand("ResetCloudsAmount", (args, notUses) => { if (args.Length < 1) { return "ERROR!"; } try { int cccloudcloudAmount = int.Parse(args[0]); if (cccloudcloudAmount < 0 || cccloudcloudAmount > 3000) { return "Your cloud amount is not available. "; } else { cloudAmount = cccloudcloudAmount; 保存设定(); } } catch { return "Could not parse " + args[0] + "to cloud amount"; } return "There will be " + cloudAmount.ToString() + " clouds"; }, "Reset the amount of clouds. No bigger than 3000 and no less than 2.");//Amount Commands.RegisterCommand("ResetCloudsSizeScale", (args, notUses) => { if (args.Length < 1) { return "ERROR!"; } try { float cccloudcloudSizeScale = float.Parse(args[0]); if (cccloudcloudSizeScale <= 0) { return "Your cloud size scale is not available. "; } else { cloudSizeScale = cccloudcloudSizeScale; 保存设定(); } } catch { return "Could not parse " + args[0] + "to cloud size scale"; } return "The clouds' size scale will be " + cloudSizeScale.ToString(); }, "Reset Clouds' Size Scale");//SizeScale Commands.RegisterCommand("ResetLowerCloudsMinHeight", (args, notUses) => { if (args.Length < 1) { return "ERROR!"; } try { float llllowerCloudsMinHeight = float.Parse(args[0]); if (llllowerCloudsMinHeight >= lowerCloudsMaxHeight) { return "Your lower cloud minimum height is not available. "; } else { lowerCloudsMinHeight = llllowerCloudsMinHeight; 保存设定(); } } catch { return "Could not parse " + args[0] + "to lower cloud minimum height"; } return "The lower clouds' minimum height will be " + lowerCloudsMinHeight.ToString(); }, "Reset Lower Clouds' Min Height");//ResetLowerCloudsMinHeight Commands.RegisterCommand("ResetLowerCloudsMaxHeight", (args, notUses) => { if (args.Length < 1) { return "ERROR!"; } try { float llllowerCloudsMaxHeight = float.Parse(args[0]); if (llllowerCloudsMaxHeight <= lowerCloudsMinHeight) { return "Your lower cloud maximum height is not available. "; } else { lowerCloudsMaxHeight = llllowerCloudsMaxHeight; 保存设定(); } } catch { return "Could not parse " + args[0] + "to lower cloud maximum height"; } return "The lower clouds' maximum height will be " + lowerCloudsMaxHeight.ToString(); }, "Reset Lower Clouds' Max Height");//ResetLowerCloudsMaxHeight Commands.RegisterCommand("ResetHigherCloudsMinHeight", (args, notUses) => { if (args.Length < 1) { return "ERROR!"; } try { float hhhhigherCloudsMinHeight = float.Parse(args[0]); if (hhhhigherCloudsMinHeight >= higherCloudsMaxHeight) { return "Your higher cloud minimum height is not available. "; } else { higherCloudsMinHeight = hhhhigherCloudsMinHeight; 保存设定(); } } catch { return "Could not parse " + args[0] + "to higher cloud minimum height"; } return "The higher clouds' minimum height will be " + higherCloudsMinHeight.ToString(); }, "Reset Higher Clouds' Min Height");//ResetHigherCloudsMinHeight Commands.RegisterCommand("ResetHigherCloudsMaxHeight", (args, notUses) => { if (args.Length < 1) { return "ERROR!"; } try { float hhhigherCloudsMaxHeight = float.Parse(args[0]); if (hhhigherCloudsMaxHeight <= higherCloudsMinHeight) { return "Your higher cloud maximum height is not available. "; } else { higherCloudsMaxHeight = hhhigherCloudsMaxHeight; 保存设定(); } } catch { return "Could not parse " + args[0] + "to higher cloud maximum height"; } return "The higher clouds' maximum height will be " + higherCloudsMaxHeight.ToString(); }, "Reset Higher Clouds' Max Height.");//ResetHigherCloudsMaxHeight Commands.RegisterCommand("ResetHigherCloudsColorRGBA", (args, notUses) => { if (args.Length < 3) { return "ERROR!You don't have all four color elements! (Red, Green, Blue, Alpha) \n Please do it like this\n ResetHigherCloudsColorRGBA 155 0 255 99"; } try { higherCloudsColor = new Color(float.Parse(args[0]) / 255f, float.Parse(args[1]) / 255f, float.Parse(args[2]) / 255f, float.Parse(args[3]) / 100f); 保存设定(); } catch { return "ERROR! Please do it like this\n ResetHigherCloudsColorRGBA 155 0 255 99"; } return "The higher cloud color will be " + higherCloudsColor.ToString(); }, "Reset the color of higher clouds by R G B A.");//ResetHigherCloudsColor Commands.RegisterCommand("ResetLowerCloudsColorRGBA", (args, notUses) => { if (args.Length < 3) { return "ERROR!You don't have all four color elements! (Red, Green, Blue, Alpha) \n Please do it like this\n ResetLowerCloudsColorRGBA 155 0 255 99"; } try { lowerCloudsColor = new Color(float.Parse(args[0]) / 255f, float.Parse(args[1]) / 255f, float.Parse(args[2]) / 255f, float.Parse(args[3]) / 100f); 保存设定(); } catch { return "ERROR! Please do it like this\n ResetLowCloudsColorRGBA 155 0 255 99"; } return "The lower cloud color will be " + lowerCloudsColor.ToString(); }, "Reset the color of lower clouds by R G B A.");//ResetLowerCloudsColor Commands.RegisterCommand("ResetSkyColorRGBA", (args, notUses) => { if (args.Length < 3) { return "ERROR!You don't have all four color elements! (Red, Green, Blue, Alpha) \n Please do it like this\n ResetSkyColorRGBA 155 0 255 99"; } try { GameObject.Find("Main Camera").GetComponent<Camera>().backgroundColor = new Color(float.Parse(args[0]) / 255f, float.Parse(args[1]) / 255f, float.Parse(args[2]) / 255f, float.Parse(args[3]) / 100f); SkyColor = new Color(float.Parse(args[0]) / 255f, float.Parse(args[1]) / 255f, float.Parse(args[2]) / 255f, float.Parse(args[3]) / 100f); 保存设定(); } catch { return "ERROR! Please do it like this\n ResetSkyColorRGBA 155 0 255 99"; } return "The sky color will be " + lowerCloudsColor.ToString(); }, "Reset the color of sky by R G B A. Default is 144 166 180 100");//ResetSkyColor Commands.RegisterCommand("Re-ProduceAllClouds", (args, notUses) => { resetCloudsNow = true; 保存设定(); return "The clouds will be re-produce"; }, "Produce your clouds again");//Reproduce All Clouds Commands.RegisterCommand("CleanFog", (args, notUses) => { isFogAway = true; 保存设定(); return FogOpreation(isFogAway); }, "Put the fog away to make your view cleaner");//Clean Fog Commands.RegisterCommand("ResetFog", (args, notUses) => { isFogAway = false; 保存设定(); return FogOpreation(isFogAway); }, "Put the fog back");//Reset Fog Commands.RegisterCommand("ResetCloudSpeed", (args, notUses) => { if (args.Length < 2) { return "ERROR!You need to have two speed value!"; } try { cloudSpeed[0] = float.Parse(args[0]); cloudSpeed[1] = float.Parse(args[1]); 保存设定(); } catch { return "ERROR!"; } CustomCloudSpeed = true; return "The speed will be: X: " + cloudSpeed[0] + " Z: " + cloudSpeed[1]; }, "Change the moving speed of yur clouds by x and z");//Cloud speed Commands.RegisterCommand("ResetFloorSizeScale", (args, notUses) => { if (args.Length < 2) { return "ERROR!"; } try { GameObject.Find("FloorBig").transform.localScale = new Vector3(float.Parse(args[0]), GameObject.Find("FloorBig").transform.localScale.y, float.Parse(args[1])); floorScale = new Vector3(float.Parse(args[0]), GameObject.Find("FloorBig").transform.localScale.y, float.Parse(args[1])); 保存设定(); } catch { return "Could not parse " + args[0] + "and" + args[1] + "to floor size scale"; } return "The floor's size scale will be " + GameObject.Find("FloorBig").transform.localScale.ToString(); }, "Reset the size of the floor as big as you want.(default is 900 900)");//FloorSizeScale Commands.RegisterCommand("ResetCameraDrawingRange", (args, notUses) => { if (args.Length < 1) { return "ERROR!"; } try { CameraFarClip = float.Parse(args[0]); if (CameraFarClip <= 1) { return "Your Range is not available. "; } else { GameObject.Find("Main Camera").GetComponent<Camera>().farClipPlane = CameraFarClip; 保存设定(); } } catch { return "Could not parse " + args[0] + "to camara drawing range"; } return "The camara drawing range will be " + GameObject.Find("Main Camera").GetComponent<Camera>().farClipPlane.ToString(); }, "Reset the camera drawing range to the value you want (no less than 1; default is 1500)");//ResetCameraDrawingRange Commands.RegisterCommand("TurnOn/OffCloudShadows", (args, notUses) => { try { if (!isShadowOff) { foreach (GameObject shadowMaker in shadow) { shadowMaker.GetComponent<Renderer>().shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off; } isShadowOff = true; 保存设定(); return "The shadow has been turned off"; } else if (isShadowOff) { foreach (GameObject shadowMaker in shadow) { shadowMaker.GetComponent<Renderer>().shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.ShadowsOnly; } isShadowOff = false; 保存设定(); return "The shadow has been turned on"; } else { return "Nothing Can be turn off/on"; } } catch { return "The shadows does not exist!"; } }, "Turn on/off your clouds' shadows");//Shadow /* Commands.RegisterCommand("AddOneFloatingRock", (args, notUses) => { if (args.Length < 3) { return "ERROR!You don't have all four position and rotation values! (X, Y, Z, Rotation) \n Please do it like this\n AddOneFloatingRock -120 110 56 92"; } if (Application.loadedLevel == 23 || floatingRock != null) { floatingRock = GameObject.Find("FloatingRocks"); GameObject.DontDestroyOnLoad(floatingRock); DontDestroyOnLoad(floatingRock); floatingRock.transform.parent = null; floatingRock.SetActive(false); try { Quaternion qtnon = new Quaternion(); qtnon.eulerAngles = new Vector3(0, float.Parse(args[3]), 0); GameObject floatingrocksClone = new GameObject(); floatingrocksCloneCount += 1; floatingrocksClone.name = ("floatingrocksClone" + floatingrocksCloneCount); floatingrocksClone = (GameObject)GameObject.Instantiate(floatingRock, new Vector3(float.Parse(args[0]), float.Parse(args[1]), float.Parse(args[2])), qtnon); floatingrocksClone.SetActive(true); } catch { if (GameObject.Find("FloatingRocks")) { return "ERROR! Please do it like this\n AddOneFloatingRock -120 110 56 93"; } else { return "You need to go Level 18 to get FloatingRocks!"; } } } else { return "The" + floatingrocksCloneCount + "'s stone will be " + GameObject.Find("floatingrocksClone" + floatingrocksCloneCount).transform.position.ToString(); } return "a"; }, "Reset the color of lower clouds by X Y Z Rotation.");//AddOneFloatingRock Commands.RegisterCommand("DeleteAllFloatingStones", (args, notUses) => { try { if (floatingRocks.Length < 1) { return "No Rocks!"; } else { for (int i = floatingRocks.Length; i >= 0; i--) { Destroy(floatingRocks[i]); } return "Done!"; } } catch { return "The stones does not existed!"; } }, "Delete All Floating Stones");//DeleteAllFloatingStones Commands.RegisterCommand("DeleteLatestFloatingStone", (args, notUses) => { try { if (floatingRocks.Length < 1) { return "No Rocks!"; } else { Destroy(floatingRocks[floatingRocks.Length]); return "Done!"; } } catch { return "The stones does not existed!"; } }, "Delete Latest Floating Stone");//DeleteLatestFloatingStones Commands.RegisterCommand("ResetLatestStoneSizeScale", (args, notUses) => { if (args.Length < 1) { return "ERROR!"; } try { float stoneSizeScale = float.Parse(args[0]); if (stoneSizeScale <= 0) { return "Your stone size scale is not available. "; } else { floatingRocks[floatingRocks.Length].transform.localScale = new Vector3(stoneSizeScale, stoneSizeScale, stoneSizeScale); } } catch { return "Could not parse " + args[0] + "to stone size scale"; } return "The clouds' size scale will be " + floatingRocks[floatingRocks.Length].transform.localScale.x.ToString(); }, "Reset the latest Stone's Size Scale");//StoneSizeScale*/ Commands.RegisterCommand("NoWorldBoundaries", (args, notUses) => { try { GameObject.Find("WORLD BOUNDARIES").transform.localScale = new Vector3(0, 0, 0); isBoundairesAway = true; 保存设定(); return "The World Boundaries will be moved away"; } catch { try { GameObject.Find("WORLD BOUNDARIES LARGE").transform.localScale = new Vector3(0, 0, 0); isBoundairesAway = true; 保存设定(); return "The World Boundaries will be moved away"; } catch { try { GameObject.Find("WORLD BOUNDARIES_LARGE").transform.localScale = new Vector3(0, 0, 0); isBoundairesAway = true; 保存设定(); return "The World Boundaries will be moved away"; } catch { try { GameObject.Find("WORLD BOUNDARIES_LARGE (1)").transform.localScale = new Vector3(0, 0, 0); isBoundairesAway = true; 保存设定(); return "The World Boundaries will be moved away"; } catch { return "The World Boundaries does not exist!"; } } } } }, "Move the World Boundaries away");//Clean World Boundaries Commands.RegisterCommand("ResetWorldBoundaries", (args, notUses) => { string tip = "The World Boundaries will be reset."; try { GameObject.Find("WORLD BOUNDARIES").transform.position = new Vector3(1, 1, 1); isBoundairesAway = false; 保存设定(); return tip; } catch { try { GameObject.Find("WORLD BOUNDARIES LARGE").transform.position = new Vector3(2.8f, 1, 2.3f); isBoundairesAway = false; 保存设定(); return tip; } catch { try { GameObject.Find("WORLD BOUNDARIES_LARGE").transform.localScale = new Vector3(5.6f, 1, 5.6f); isBoundairesAway = false; 保存设定(); return tip; } catch { try { GameObject.Find("WORLD BOUNDARIES_LARGE (1)").transform.localScale = new Vector3(3, 0, 3); isBoundairesAway = false; 保存设定(); return tip; } catch { return "The World Boundaries does not exist!"; } } } } }, "Put the World Boundaries back");//Reset World Boundaries Commands.RegisterCommand("On/OffNightMode", (args, notUses) => { try { if (!IsNightMode) { IsNightMode = true; GameObject.Find("Main Camera").GetComponent<Camera>().backgroundColor = new Color(0.1f, 0.1f, 0.1f); GameObject DL = GameObject.Find("Directional light"); if (DL) { /*try { DL.GetComponent<Light>().intensity = 0f; DL.GetComponent<LensFlare>().brightness = 10; DL.GetComponent<LensFlare>().color = Color.white; DL.GetComponent<LensFlare>().enabled = true; DL.GetComponent<LensFlare>().fadeSpeed = 1; } catch { }*/ } ItIsNightSoEveryCloudShouldBeDeepDarkFantasy(); 保存设定(); return "Night is coming......"; } else { IsNightMode = false; GameObject.Find("Main Camera").GetComponent<Camera>().backgroundColor = new Color(0.5803922f, 0.6509804f, 0.7058824f, 1); ; GameObject DL = GameObject.Find("Directional light"); if (DL) { GameObject.Find("Directional light").GetComponent<Light>().intensity = 0.92f; /*try { Destroy(GameObject.Find("Directional light").GetComponent<LensFlare>()); } catch { }*/ } ItIsDaySoEveryCloudShouldBeBright(); 保存设定(); return "Day is coming _(:3」∠)_"; } } catch { return "The Main Camera does not exists!"; } }, "Turn on/off the night mode");//Night Commands.RegisterCommand("ApplyFloorTexture", (args, notUses) => { float sizeScale = 1; try { sizeScale = float.Parse(args[0]); } catch { Debug.Log("Please give me your scale! Or I will defautly define it as 1."); sizeScale = 1; } try { GameObject FloorBig = GameObject.Find("FloorBig"); GameObject FloorGrid = GameObject.Find("FloorGrid"); Renderer FBRenderer = FloorBig.GetComponent<Renderer>(); try { WWW png = new WWW("File:///" + Application.dataPath + "/Mods/Blocks/Textures/GroundTexture.png"); WWW jpg = new WWW("File:///" + Application.dataPath + "/Mods/Blocks/Textures/GroundTexture.jpg"); FBRenderer.material = new Material(Shader.Find("Diffuse")); //GameObject.Find("FloorBig").GetComponent<Renderer>().material.mainTexture.wrapMode = TextureWrapMode.Clamp; if (png.size > 5) { try { FBRenderer.material.mainTexture = new WWW("File:///" + Application.dataPath + "/Mods/Blocks/Textures/GroundTexture.png").texture; } catch { } } else if (jpg.size > 5) { try { FBRenderer.material.mainTexture = new WWW("File:///" + Application.dataPath + "/Mods/Blocks/Textures/GroundTexture.jpg").texture; } catch { } } else { return ("There is no such a texture file named \"GroundTexture.png\" or \"GroundTexture.jpg\" \n under \\Besiege_Data\\Mods\\Blocks\\Textures\\! "); } FBRenderer.material.SetTextureScale("_MainTex", Vector2.one * 1 / sizeScale); FloorGrid.transform.position = new Vector3(0, -15, 0); } catch { } } catch { return "Something wrong happened! Please make sure that the legal floor (not level 30 floor or well floor) exists!"; } return "Applied!"; }, "Set the floor texture");//FloorTexture Commands.RegisterCommand("ApplyFloorTexture2", (args, notUses) => { float sizeScale = 1; try { sizeScale = float.Parse(args[0]); } catch { Debug.Log("Please give me your scale! Or I will defautly define it as 1."); sizeScale = 1; } try { GameObject FloorGrid = GameObject.Find("FloorGrid"); Renderer FGRenderer = FloorGrid.GetComponent<Renderer>(); try { WWW png = new WWW("File:///" + Application.dataPath + "/Mods/Blocks/Textures/GroundTexture.png"); WWW jpg = new WWW("File:///" + Application.dataPath + "/Mods/Blocks/Textures/GroundTexture.jpg"); FGRenderer.material = new Material(Shader.Find("Diffuse")); //GameObject.Find("FloorBig").GetComponent<Renderer>().material.mainTexture.wrapMode = TextureWrapMode.Clamp; if (png.size > 5) { try { FGRenderer.material.mainTexture = new WWW("File:///" + Application.dataPath + "/Mods/Blocks/Textures/GroundTexture.png").texture; } catch { } } else if (jpg.size > 5) { try { FGRenderer.material.mainTexture = new WWW("File:///" + Application.dataPath + "/Mods/Blocks/Textures/GroundTexture.jpg").texture; } catch { } } else { return ("There is no such a texture file named \"GroundTexture.png\" or \"GroundTexture.jpg\" \n under \\Besiege_Data\\Mods\\Blocks\\Textures\\! "); } FGRenderer.material.SetTextureScale("_MainTex", Vector2.one * 1 / sizeScale); FloorGrid.transform.position = new Vector3(0, -5, 0); } catch { } } catch { return "Something wrong happened! Please make sure that the legal floor (not level 30 floor or well floor) exists!"; } return "Applied!"; }, "Set the floor texture in a different way");//FloorTextureD Commands.RegisterCommand("On/OffExtraCannonEffect", (args, notUses) => { ExtraCannonSmokeEffect = !ExtraCannonSmokeEffect; 保存设定(); return "Extra Cannon Effect is now" + ExtraCannonSmokeEffect; }, "Add Extra Smoke and light to cannons");//Cannon }
private void ModifyPlanet(CelestialBody oldB, CelestialBody newB) { Debug.Log("Planitron: ModifyPlanet oldB.GetName() = " + oldB.GetName()); Debug.Log("Planitron: ModifyPlanet newB.GetName() = " + newB.GetName()); _currentPlanetName = newB.GetName(); RoundedGeeASL = newB.GeeASL; RoundedGeeASL = Math.Round(RoundedGeeASL, 2); _currentGee = RoundedGeeASL.ToString(); if (newB.atmosphere) { _currentatmosphereMultiplier = newB.atmosphereMultiplier.ToString(); } else { _currentatmosphereMultiplier = "None"; } _currentOxygen = newB.atmosphereContainsOxygen; oldB.atmoshpereTemperatureMultiplier = newB.atmoshpereTemperatureMultiplier; oldB.atmosphere = newB.atmosphere; oldB.atmosphereContainsOxygen = newB.atmosphereContainsOxygen; oldB.atmosphereMultiplier = newB.atmosphereMultiplier; oldB.atmosphereScaleHeight = newB.atmosphereScaleHeight; col_R = newB.atmosphericAmbientColor.r; col_G = newB.atmosphericAmbientColor.g; col_B = newB.atmosphericAmbientColor.b; col_A = newB.atmosphericAmbientColor.a; col_RGBA = new Color(col_R, col_G, col_B, col_A); oldB.atmosphericAmbientColor = col_RGBA; oldB.GeeASL = newB.GeeASL; oldB.gMagnitudeAtCenter = newB.gMagnitudeAtCenter; oldB.gravParameter = newB.gravParameter; oldB.Mass = newB.Mass; oldB.pressureMultiplier = newB.pressureMultiplier; oldB.staticPressureASL = newB.staticPressureASL; Debug.Log(" "); Debug.Log("Planitron: ModifyPlanet: New Values for vessel.mainBody ----------------------------"); Debug.Log("Planitron: ModifyPlanet Post Name = " + oldB.GetName()); Debug.Log("Planitron: ModifyPlanet Post atmoshpereTemperatureMultiplier = " + oldB.atmoshpereTemperatureMultiplier); Debug.Log("Planitron: ModifyPlanet Post atmosphere = " + oldB.atmosphere); Debug.Log("Planitron: ModifyPlanet Post atmosphereContainsOxygen = " + oldB.atmosphereContainsOxygen); Debug.Log("Planitron: ModifyPlanet Post atmosphereMultiplier = " + oldB.atmosphereMultiplier); Debug.Log("Planitron: ModifyPlanet Post atmosphereScaleHeight = " + oldB.atmosphereScaleHeight); Debug.Log("Planitron: ModifyPlanet Post col_RGBA.ToString = " + col_RGBA.ToString()); Debug.Log("Planitron: ModifyPlanet Post col_RGBA = " + col_RGBA); Debug.Log("Planitron: ModifyPlanet Post atmosphericAmbientColor = " + oldB.atmosphericAmbientColor.ToString()); Debug.Log("Planitron: ModifyPlanet Post GeeASL = " + oldB.GeeASL); Debug.Log("Planitron: ModifyPlanet Post gMagnitudeAtCenter = " + oldB.gMagnitudeAtCenter); Debug.Log("Planitron: ModifyPlanet Post gravParameter = " + oldB.gravParameter); Debug.Log("Planitron: ModifyPlanet Post Mass = " + oldB.Mass); Debug.Log("Planitron: ModifyPlanet Post pressureMultiplier = " + oldB.pressureMultiplier); Debug.Log("Planitron: ModifyPlanet Post staticPressureASL = " + oldB.staticPressureASL); Debug.Log(" "); Debug.Log(" "); }
public void SetPlayer(int player,Color color) { Debug.Log(name +": "+ player.ToString() + " " + color.ToString()); m_Image.sprite = m_PlayerSprites[player]; m_Image.color = color; }