예제 #1
0
 public void openHighSearch(GameObject show, GameObject dispear)
 {
     CameraUtil.push(4, 3);
     show.GetComponent <JustChangeLayer>().change(11);;
     show.SetActive(true);
     dispear.SetActive(false);
 }
예제 #2
0
    public static void confirm(string tip, EventDelegate sure, EventDelegate cancle)
    {
        if (currentConfirm != null)
        {
            return;
        }
        currentConfirm = GameObject.Find("pops").transform.FindChild("confirm").gameObject;
        currentConfirm.SetActive(true);
        UILabel label = currentConfirm.transform.FindChild("label-con").gameObject.GetComponent <UILabel>();

        label.text = tip;
        UIButton button = currentConfirm.transform.FindChild("sure-con").gameObject.GetComponent <UIButton>();

        button.onClick.Clear();
        button.onClick.Add(sure);
        button = currentConfirm.transform.FindChild("cancle-con").gameObject.GetComponent <UIButton>();
        button.onClick.Clear();
        button.onClick.Add(cancle);
        CameraUtil.push(1, 3);
        Transform trans_base = currentConfirm.transform.parent.parent;

        for (int i = 0; i < trans_base.childCount; i++)
        {
            Transform sun = trans_base.GetChild(i);
            if (!sun.Equals(currentConfirm.transform.parent))
            {
                MyUtilTools.changeAlpha(0.2f, sun.gameObject);
            }
        }
    }
예제 #3
0
 public IEnumerator FadeInFromBlack(float time, Action onComplete)
 {
     return(CameraUtil.FadeFrom(_blackScreen.GetComponent <GUITexture>(), time, () => {
         Object.Destroy(_blackScreen);
         onComplete();
     }));
 }
예제 #4
0
 void back(string str)
 {
     if (!MyUtilTools.stringIsNull(str))
     {
         if (!flag)
         {
             string[] ss  = str.Split(" "[0]);
             string[] ssy = ss[0].Split("-"[0]);
             year.value  = ssy[0];
             month.value = ssy[1];
             day.value   = ssy[2];
             string[] sst = ss[1].Split(":"[0]);
             hour.value   = sst[0];
             minute.value = sst[1];
         }
         else
         {
             UILabel time_label = transform.parent.FindChild("value").GetComponent <UILabel>();
             if (justDate)
             {
                 string[] ss = str.Split(" "[0]);
                 time_label.text = ss[0];
             }
             else
             {
                 time_label.text = str;
             }
         }
     }
     panel.alpha = 1f;
     CameraUtil.pop(5);
 }
예제 #5
0
파일: Ball.cs 프로젝트: lefton22/gpp_qiu
    private IEnumerator Behavior()
    {
        while (gameObject.activeInHierarchy)
        {
            // Pulse for a sec
            var startScale = Vector3.one;
            var endScale   = Vector3.one * 1.25f;
            yield return(Coroutines.DoOverEasedTime(_pulseInterval / 2, Easing.BounceEaseOut, t =>
            {
                transform.localScale = Vector3.Lerp(startScale, endScale, t);
            }));

            yield return(Coroutines.DoOverEasedTime(_pulseInterval / 2, Easing.BounceEaseOut, t =>
            {
                transform.localScale = Vector3.Lerp(endScale, startScale, t);
            }));


            // Pick a random spot
            var startPos = transform.position;
            var endPos   = CameraUtil.RandomPositionInView(transform.position.z);
            // Move there
            yield return(Coroutines.DoOverEasedTime(_moveInterval, Easing.CircEaseIn, t =>
            {
                transform.position = Vector3.Lerp(startPos, endPos, t);
            }));
        }
    }
예제 #6
0
    public void open()
    {
        panel.alpha = 0.1f;
        //UILabel target = gameObject.GetComponent<UILabel>();
        string str = null;

        if (!flag)
        {
            str = year.value + "-" + month.value + "-" + day.value + " " + hour.value + ":" + minute.value + ":00";
        }
        else
        {
            UILabel time_label = transform.parent.FindChild("value").GetComponent <UILabel>();
            str = time_label.text;
        }
        Calendar calender = Calendar.create(base_obj, str);

        if (JustRun.Instance.isAdmin)
        {
            calender.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f);
        }
        else
        {
            calender.transform.localScale = new Vector3(1f, 1f, 1f);
        }
        CameraUtil.push(5, 3);
        calender.CallBack = back;
    }
예제 #7
0
    public void Update()
    {
        GameObject gohero = EntityFactory.MainHero;

        if (gohero != null)
        {
            Vector3 vhero = gohero.transform.position;
            if (SoldierCamera.MainInstance <SoldierCamera>() != null && SoldierCamera.MainInstance <SoldierCamera>().cameraMode == CameraMode.MapGodControl)
            {
                vhero = CameraUtil.GetGodEyePos();
            }
            Vector3 vtotallen = vsize;
            vtotallen.y = 0.0f;
            float ftotallen = vtotallen.magnitude;
            float fvislen   = ftotallen * VisFactor;

            foreach (DictionaryEntry keypair in groups)
            {
                int           key = (int)keypair.Key;
                AdorningGroup ag  = (AdorningGroup)keypair.Value;

                Vector3 vdir = vhero - ag.pos;
                vdir.y = 0.0f;
                float flen = vdir.magnitude;

                bool bVis = flen < fvislen;
                ag.SetVisable(bVis, 0.1f, FadeTime, FadeEnable);
            }
        }
    }
예제 #8
0
        private void updateCameraAnim()
        {
            Transform camTrans = camTransform;

            if (m_cameraAnimMainCamera)
            {
                camTrans = Camera.main.transform;
            }
            camTrans.position = m_camAnimTrans.position;
            Vector3 angle = m_camAnimTrans.eulerAngles;

            camTrans.eulerAngles = angle;
            float focal = m_camFOVTrans.localScale.z;
            float fov   = Mathf.Atan(30.0f / focal) / Mathf.PI * 180.0f;

            m_Camera.fieldOfView = fov;

            if (m_cameraAminFollowHero && soldier.gameObject)
            {
                m_camRecTrans.position = soldier.gameObject.transform.position;
                if (m_cameraAnimProjectFloor)
                {
                    m_camRecTrans.position = CameraUtil.ProjectToFloor(m_camRecTrans.position);
                }
            }

            uint tick = GameLogicAPI.getTickCount();

            if (tick > m_cameraAnimStopTick)
            {
                StopCameraAnim();
            }
        }
        protected override void OnUpdate()
        {
            _input = World.GetExistingSystem <InputSystem>();

            switch (Process)
            {
            case true:
            {
                PositionCurrent = CameraUtil.ScreenPointToWorldPoint(World, InputUtil.GetInputPosition(_input));
                if (InputUtil.GetInputUp(_input))
                {
                    PositionUp = PositionCurrent;
                    Process    = false;
                    OnEndProses();
                }

                break;
            }

            case false when InputUtil.GetInputDown(_input):
                PositionDown = CameraUtil.ScreenPointToWorldPoint(World, InputUtil.GetInputPosition(_input));

                Process = true;
                OnStartProses();
                break;
            }
        }
예제 #10
0
파일: Game.cs 프로젝트: Peng-Zhiyuan/puzzle
    void Start()
    {
        Application.logMessageReceived += OnUnityLog;
        UnityEngine.Random.InitState(DateTime.UtcNow.Second);
        StaticDataLite.Init();
        UIEngine.Init();
        PlayerStatus.Read();
        UIEngine.Forward("LoadingPage", null, new Admission_None());
        //UIEngine.Forward<LevelCompletePage>();
        if (GameInfo.ForceDeveloper)
        {
            var commandline = UIEngine.ShowFloating <CommandLineFloating>(null, UIDepth.Top);
        }
        if (GameInfo.ForceRemoveAd)
        {
            PlayerStatus.removeAd = true;
        }
        PushManager.ResetNotification();

        // 摄像机渲染区域默认根据高去调整宽
        // 但是这里需要根据宽调整高
        // 因此需要手动设置摄像机的渲染高度,达到宽度固定 1080 效果

        heightScale = CameraUtil.SetCameraSizeByDecisionRevelutionAndFixAtWidth(1080, 1920);

        var silence = GameManifestFinal.Get("silence", "false");

        if (silence == "true")
        {
            AudioManager.Volume = 0;
        }
    }
예제 #11
0
/*
 *  IEnumerator openCamera()
 *  {
 *      yield return Application.RequestUserAuthorization(UserAuthorization.WebCam);
 *      if (cameraTexture != null)
 *      {
 *          cameraTexture.Play();
 *      }
 *      else if (Application.HasUserAuthorization(UserAuthorization.WebCam))
 *      {
 *          WebCamDevice[] devices = WebCamTexture.devices;
 *          string deviceName = devices[0].name;
 *          UITexture texture = transform.FindChild("rect").FindChild("Texture").GetComponent<UITexture>();
 *          cameraTexture = new WebCamTexture(deviceName,texture.width,texture.height,FPS);
 *          cameraTexture.Play();
 *          int w = cameraTexture.height;
 *          int h = cameraTexture.width;
 *          temps = new Color32[w*h];
 *          t2d = new Texture2D(w,h);
 *          _transform();
 *          texture.mainTexture = t2d;
 *      }
 *  }
 *
 *  private void _transform()
 *  {
 *      Color32[] datas = cameraTexture.GetPixels32();
 *      int w = cameraTexture.width;
 *      int h = cameraTexture.height;
 *      for (int i = 0; i < h; i++)
 *      {
 *          for (int j = 0; j < w; j++)
 *          {
 *              int index1 = i * w + j;
 *              int index2 = (w - j - 1) * h + i;
 *              temps[index2] = datas[index1];
 *          }
 *      }
 *      t2d.SetPixels32(temps);
 *      t2d.Apply();
 *  }
 *
 *  public void picture()
 *  {
 *      if (cameraTexture != null)
 *      {
 *          _transform();
 *          cameraTexture.Stop();
 *          Texture2D texture2d = new Texture2D(t2d.width,t2d.height);
 *          texture2d.LoadImage(t2d.EncodeToPNG());
 *          //target.mainTexture = texture2d;
 *          if (callBack != null)
 *          {
 *              callBack.parameters[0] = new EventDelegate.Parameter();
 *              callBack.parameters[0].obj = texture2d;
 *              callBack.Execute();
 *          }
 *      }
 *      over();
 *  }
 */
    public void over()
    {
        CameraUtil.pop(4);
        panel.alpha = 1f;
        gameObject.SetActive(false);
        callBack = null;
    }
예제 #12
0
    public void Reset()
    {
        LookAtOrigin();
        CameraUtil cameraUtil = target as CameraUtil;

        cameraUtil.transform.position = new Vector3(-17, 30, -26);
    }
예제 #13
0
    private void SwitchCamMode(CameraMode mode, CameraContext context = null)
    {
        if (cameraControlModeParam == null || curCameraModeParam == null)
        {
            return;
        }
        CameraMode oldMode = cameraMode;

        cameraMode = mode;  //保证外部拿到的cameraMode是当前的?

        if (camCtrl != null)
        {
            if (camCtrl.GetCameraMode() == mode)    //同一个状态不能重复进入
            {
                return;
            }
            curCameraModeParam.FOV               = m_userDesireFov;
            curCameraModeParam.curPitchAngle     = m_userDesireAngle.x;
            curCameraModeParam.curDistance       = m_userDesireDistance;
            cameraControlModeParam[(int)oldMode] = curCameraModeParam;
            camCtrl.Leave();
        }
        camCtrl = CameraUtil.GetCamCtrl(mode);
        camCtrl.curCameraMode = mode;
        curCameraModeParam    = cameraControlModeParam[(int)mode];
        camCtrl.Enter(context);
    }
예제 #14
0
        private IEnumerator ViewAsset()
        {
            yield return(new WaitForSeconds(0.5f));

            System.Random ran    = new System.Random();
            int           sIndex = ran.Next(0, pSprites.Count);
            int           pIndex = ran.Next(0, prefabs.Count);

            Set2DSpriteValue(sprites [0], pSprites [sIndex]);

            if (cube != null)
            {
                Destroy(cube);
            }

            Vector3 position = Vector3.zero;

            if (SceneManager.Instance._UIType == UIType.NGUI)
            {
                position = CameraUtil.GetViewportToWorldPoint(containers [0].gameObject, mCam);
            }
            else
            {
                position = containers [0].gameObject.transform.position;
            }

            cube = Instantiate(prefabs [pIndex]) as GameObject;
            cube.transform.localPosition = position;
            cube.transform.parent        = gObj.transform;

            StartCoroutine(ViewAsset());
        }
예제 #15
0
    public static void tip(string str, bool flag = false, EventDelegate doSomthing = null)
    {
        if (currentTip == null)
        {
            currentTip = GameObject.Find("pops").transform.FindChild("tip").gameObject;
            currentTip.SetActive(true);
        }
        UILabel label = currentTip.transform.FindChild("label-tip").gameObject.GetComponent <UILabel>();

        label.text = str;
        if (!currentTip.activeSelf)
        {
            currentTip.SetActive(true);
        }
        UISprite sprite = currentTip.transform.FindChild("flag").gameObject.GetComponent <UISprite>();

        sprite.spriteName = flag ? "Checkmark" : "X Mark";
        Transform trans_base = currentTip.transform.parent.parent;

        for (int i = 0; i < trans_base.childCount; i++)
        {
            Transform sun = trans_base.GetChild(i);
            if (!sun.Equals(currentTip.transform.parent))
            {
                MyUtilTools.changeAlpha(0.2f, sun.gameObject);
            }
        }
        CameraUtil.push(2, 3);
        if (doSomthing != null)
        {
            currentTip.GetComponent <DialogUtil>().needDoSmoething = doSomthing;
        }
    }
예제 #16
0
        public List <ExtInput> GetVisionObjects()
        {
            var output = JsonUtility.FromJson <JOutput>(lastJson);

            var ret = new List <ExtInput>();
            int numBlues = 0, numReds = 0;

            foreach (var item in output.items)
            {
                var pos = visionBoundingBox.GetScreenPoint(CameraUtil.MainDimens(), item.pt);
                pos = PosAdjustments(pos);

                if (string.Equals(item.color, "blue"))
                {
                    var it = new ExtInput {
                        id = 100 + numBlues++, type = TileType.BLUE_ROD, position = pos
                    };
                    ret.Add(it);
                }
                else if (string.Equals(item.color, "red"))
                {
                    var it = new ExtInput {
                        id = 1000 + numReds++, type = TileType.RED_CUBE, position = pos
                    };
                    ret.Add(it);
                }
            }

            return(ret);
        }
예제 #17
0
 public void grabBack()
 {
     gameObject.SetActive(false);
     transform.parent.FindChild("body").GetComponent <UIPanel>().alpha = 1f;
     GameObject.Find("main").transform.FindChild("back").gameObject.SetActive(true);
     CameraUtil.pop(3);
     Destroy(this);
 }
예제 #18
0
    public void OnSceneLoaded()
    {
        _worldCamera = CameraUtil.FindMainCamera();

        SoundManager.instance.CreateLowPassFilter();

        Debug.Log("EaMainframe - OnSceneLoaded frameCount : " + Time.frameCount);
    }
예제 #19
0
 public override void OnLateUpdate()
 {
     if (m_Target != null && m_Camera != null)
     {
         var uiPosition = CameraUtil.ConvertPosition(m_Camera, UIRoot.uiCamera, m_Target.position.SetY(yRecord));
         this.transform.position = uiPosition.SetZ(UIRoot.hudRoot.transform.position.z);
     }
 }
예제 #20
0
 public void close()
 {
     gameObject.SetActive(false);
     panel.alpha = 1f;
     CameraUtil.pop(5);
     temp = null;
     MyUtilTools.clearChild(transform.FindChild("container"));
 }
예제 #21
0
 //TODO @chenjie 临时放置,应该放在通用的Geometry中
 public static Vector3[] GetHitPoints(Camera camera, Plane plane)
 {
     Vector3[] nearCorners;
     Vector3[] farCorners;
     CameraUtil.GetCameraCornors(camera, out nearCorners, out farCorners);
     Vector3[] hitPoints = GetHitPoints(nearCorners, farCorners, plane);
     return(hitPoints);
 }
예제 #22
0
    public void backFromSearchReult()
    {
        CameraUtil.pop(8);
        GameObject result = transform.FindChild("list").FindChild("result").gameObject;

        result.SetActive(false);
        transform.FindChild("list").FindChild("body").GetComponent <UIPanel>().alpha = 1f;
    }
예제 #23
0
 IEnumerator trackMouse()
 {
     while (IsTrackingMouse)
     {
         setEndPosition(CameraUtil.ScreenToWorldPosition(Input.mousePosition, 50));
         yield return(new WaitForEndOfFrame());
     }
 }
예제 #24
0
 public IEnumerator FadeToBlack(float time, Action onComplete)
 {
     ;
     _blackScreen = GameObject.Instantiate(Resources.Load <GameObject>("BlackScreen")) as GameObject;
     _blackScreen.transform.position = new Vector3(0.5f, 0.5f);
     Object.DontDestroyOnLoad(_blackScreen);
     return(CameraUtil.FadeTo(_blackScreen.GetComponent <GUITexture>(), time, onComplete));
 }
예제 #25
0
        Vector3 GetWorldPos(Vector3 editorPos)
        {
            var mDimens  = CameraUtil.MainDimens();
            var edDimens = visionHelper.GetCameraDimens();
            var x        = editorPos.x * (mDimens.x / edDimens.x);
            var y        = editorPos.y * (mDimens.y / edDimens.y);

            return(new Vector2(x, y));
        }
예제 #26
0
    public Vector3 GetHitPointSpin()
    {
        Vector3[] hitPoints = CameraUtil.GetHitPoints(camera, plane);
        Vector3   min;
        Vector3   max;

        CameraUtil.GetMinMaxVector3(hitPoints, out min, out max);
        return(max - min);
    }
예제 #27
0
    public void LogHitPoints()
    {
        Vector3[] hitPoints = CameraUtil.GetHitPoints(camera, plane);
        Vector3   min;
        Vector3   max;

        CameraUtil.GetMinMaxVector3(hitPoints, out min, out max);
        Debug.LogFormat("cornors:{0}, min:{1}, max:{2}, max-min:{3}", hitPoints.IEnumerableToString(), min, max, max - min);
    }
예제 #28
0
        static void Main()
        {
            BCSV.PopulateHashTable();
            CameraUtil.InitCameras();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainWindow());
        }
예제 #29
0
    public void LookAtOrigin()
    {
        CameraUtil cameraUtil = target as CameraUtil;
        Transform  origin     = cameraUtil.origin;

        if (origin != null)
        {
            cameraUtil.transform.LookAt(origin);
        }
    }
예제 #30
0
 void tryToClosePush()
 {
     CameraUtil.pop(6);
     foreach (GameObject obj in others)
     {
         MyUtilTools.changeAlpha(1, obj);
     }
     transform.FindChild("base").gameObject.SetActive(false);
     isOpen = false;
 }