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;
}
}
}
}
//удаляем первое вхождение скобки с начала строки.
var str1='123 (123(123))'.replace('(','');
//удаляем первое вхождение скобки с конца строки.
var str2=str1.replace(/)$/,'');
alert(str2);
local star = {}
for i=1,50 do
star[i] = display.newCircle(math.random(0,display.contentWidth),math.random(0,display.contentHeight), math.random(1,3))
star[i].anchorX =0.5
star[i].anchorY =0.5
star[i].time = math.random(3,20)
star[i].animateUp = function ()
star[i].x = math.random(0,display.contentWidth)
star[i].y = math.random(0,display.contentHeight)
transition.to( star[i], { time= star[i].time * 100, alpha = 1, xScale = 1, yScale = 1, onComplete=star[i].animateDown } )
end
star[i].animateDown = function ()
transition.to( star[i], { time= star[i].time * 500, alpha = 0, xScale = 0.01, yScale = 0.01, onComplete=star[i].animateUp } )
end
star[i].animateDown()
end