using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraController : MonoBehaviour
{
public int Mobile = 640;
public int Tablet = 852;
void Start()
{
if (Camera.main.pixelHeight > Camera.main.pixelWidth){
//PORTRAIT
float ratio = (float) Camera.main.pixelHeight/Camera.main.pixelWidth;
if (ratio >= 1.5f)
{
Camera.main.orthographicSize = (float) (Mobile*ratio)/200f;
}
else
{
Camera.main.orthographicSize = (float) (Tablet*ratio)/200f;
}
}
else
{
//LANDSCAPE
float ratio = (float) Camera.main.pixelWidth/Camera.main.pixelHeight;
if (ratio >= 1.5f)
{
Camera.main.orthographicSize = (float) Mobile/200f;
}
else
{
Camera.main.orthographicSize = (float) Tablet/200f;
}
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class canvasController : MonoBehaviour
{
private int mobile = 640;
private int tablet = 852;
private void Start()
{
Camera _camera = Camera.main;
float aspect = (float) _camera.pixelHeight/_camera.pixelWidth;
//--------------------------------------------------------------------------
Canvas _canvas = this.GetComponent<Canvas>();
_canvas.renderMode = RenderMode.ScreenSpaceCamera;
_canvas.worldCamera = _camera;
//--------------------------------------------------------------------------
if (aspect >= 1.5f)
{
GetComponent<CanvasScaler>().referenceResolution = new Vector2(mobile, mobile*_camera.pixelHeight/_camera.pixelWidth);
}
else
{
GetComponent<CanvasScaler>().referenceResolution = new Vector2(tablet, tablet*_camera.pixelHeight/_camera.pixelWidth);
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraController : MonoBehaviour
{
public int Mobile = 640;
public int Tablet = 852;
void Start()
{
if (Camera.main.pixelHeight > Camera.main.pixelWidth){
//PORTRAIT
float ratio = (float) Camera.main.pixelHeight/Camera.main.pixelWidth;
if (ratio >= 1.5f)
{
Camera.main.orthographicSize = (float) (Mobile*ratio)/200f;
}
else
{
Camera.main.orthographicSize = (float) (Tablet*ratio)/200f;
}
}
else
{
//LANDSCAPE
float ratio = (float) Camera.main.pixelWidth/Camera.main.pixelHeight;
if (ratio >= 1.5f)
{
Camera.main.orthographicSize = (float) Mobile/200f;
}
else
{
Camera.main.orthographicSize = (float) Tablet/200f;
}
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class canvasController : MonoBehaviour
{
private int mobile = 640;
private int tablet = 852;
private void Start()
{
Camera _camera = Camera.main;
float aspect = (float) _camera.pixelHeight/_camera.pixelWidth;
//--------------------------------------------------------------------------
Canvas _canvas = this.GetComponent<Canvas>();
_canvas.renderMode = RenderMode.ScreenSpaceCamera;
_canvas.worldCamera = _camera;
//--------------------------------------------------------------------------
if (aspect >= 1.5f)
{
GetComponent<CanvasScaler>().referenceResolution = new Vector2(mobile, mobile*_camera.pixelHeight/_camera.pixelWidth);
}
else
{
GetComponent<CanvasScaler>().referenceResolution = new Vector2(tablet, tablet*_camera.pixelHeight/_camera.pixelWidth);
}
}
}
var text0='123 (456(789))';
var text1=DeleteSubStr(text0, '(', 1);
var text2=DeleteSubStr(text1, ')', 1);
alert(text2)
function DeleteSubStr( source, substr, position) {
var count = 0;
var result = '';
for (var i=0; i<source.length; i++)
{
if (source[i] == substr) {
count=count+1;
}
if (count != position ){
result=result+source[i] ;
}else{
count=count+1;
}
}
return result;
}