示例#1
0
文件: Form1.cs 项目: magicacg/Picbad
        private async Task <string> UploadToTourouAsync(string line)
        {/// await Tourou.UploadFileAsync(line)
            String Json  = "";
            int    count = 0;

            while (true)
            {
                if (count++ < 3)
                {
                    Json = await Tourou.UploadFileAsync(line, uploadFileCompleted, uploadProgress);

                    if (Json != "")
                    {
                        break;
                    }
                    else
                    {
                        Console.WriteLine("文件{0}上传失败,重试{2}次。", Path.GetFileNameWithoutExtension(line), count);
                    }
                }
                else
                {
                    Console.WriteLine("反复上传失败,直接放弃!"); break;
                }
            }
            return(Json);
        }
    /// <summary>
    /// 灯篭の数を確認
    /// </summary>
    private void TourouConflicted()
    {
        if (m_TriggerEnterIn)
        {
            // クールタイマー
            m_CoolTimer += Time.deltaTime;

            // HalfPoint2に進入してすぐ止めると不自然なので、進入して2秒後に灯篭を止める
            if (m_CoolTimer >= 2.0f)
            {
                m_CoolTimer = 0.0f;

                // 沈んでない灯篭をリストに追加
                foreach (GameObject tourou in GameObject.FindGameObjectsWithTag("Tourou"))
                {
                    Tourou tourouScript = tourou.GetComponent <Tourou>();
                    if (tourouScript.tourouDown)
                    {
                        continue;
                    }
                    m_TourouList.Add(tourouScript);
                    // 灯篭スクリプトじたいを止める
                    tourouScript.enabled = false;
                    // 灯篭のスピードを止める
                    //tourouScript.waterSpeed = 0.0f;
                    //// 灯篭を沈めさせない
                    //tourouScript.tourouDown = false;
                    //// カメラ外処理を止める
                    //tourouScript.isOutOfScreen(false);
                    // カメラの追従を止める
                    GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Chasing_Camera>().enabled = false;
                    // カメラの回転フラグ
                    m_CameraIsScreen          = true;
                    m_FireCharacterProduction = true;
                }
            }
        }

        // カメラの回転フラグ
        if (m_CameraIsScreen)
        {
            // 花火の方向を向かせるためのメソッド
            TargetLookRotateAngle(m_RotateCompletion);
        }
    }
    private void OnEnable()
    {
        if (m_ReloadListFlag)
        {
            // 沈んでない灯篭をリストに追加(灯篭全体のリスト)
            foreach (GameObject tourou in GameObject.FindGameObjectsWithTag("Tourou"))
            {
                Tourou tourouScript = tourou.GetComponent <Tourou>();
                if (tourouScript.tourouDown)
                {
                    continue;
                }
                m_TourouList.Add(tourouScript);

                m_ReloadListFlag = false;
            }
        }
    }
    // Update is called once per frame
    void Update()
    {
        //TourouConflicted();

        // 沈んでいる灯篭をリストから削除
        foreach (GameObject tourou in GameObject.FindGameObjectsWithTag("Tourou"))
        {
            Tourou tourouScript = tourou.GetComponent <Tourou>();
            if (tourouScript.tourouDown == false)
            {
                continue;
            }
            m_TourouList.Remove(tourouScript);
        }

        if (m_TourouEnterListFlag == true)
        {
            OnTriggerEnterConflicted();
            DoNotReachTheMidpoint();
        }

        if (m_FireCharacterProduction == true)
        {
            FireCharacterFadeProcessing();
        }

        if (m_FireworksProduction == true)
        {
            StartFireworksFadeProcessing();
        }

        if (m_FireworksEndingProduction == true)
        {
            EndFirewoorksFadeProcessing();
        }
    }
示例#5
0
    /// <summary>
    /// カメラから最も遠い灯篭の座標を探す
    /// またはカメラから最も遠い灯篭が二個以上ある場合、最も遠い座標の中間点を探す
    /// </summary>
    /// <returns></returns>
    public Vector3 mostDitances()
    {
        //沈んでいない灯篭をリストに追加
        List <Tourou> tourous = new List <Tourou>();

        foreach (GameObject tourou in GameObject.FindGameObjectsWithTag("Tourou"))
        {
            Tourou t = tourou.GetComponent <Tourou>();
            if (t.tourouDown)
            {
                continue;
            }
            tourous.Add(t);
        }

        //一番遠い灯篭との距離
        float mostFarDistance = 0.0f;
        //一番遠い灯篭の座標
        Vector3 mostFarPosition = transform.position;

        foreach (Tourou t in tourous)
        {
            Vector3 tourouPosition = t.transform.position;
            //灯篭とカメラとの距離
            float distance_ = (this.transform.position - tourouPosition).magnitude;

            //遠かったら変数に代入
            if (mostFarDistance <= distance_)
            {
                mostFarDistance = distance_;
                mostFarPosition = t.transform.position;
            }

            Debug.DrawLine(this.transform.position, tourouPosition, Color.red);
        }

        //一番遠い灯篭に近い灯篭をリストに追加
        List <Vector3> mostFarDistances = new List <Vector3>();

        mostFarDistances.Add(mostFarPosition);
        foreach (Tourou t in tourous)
        {
            Vector3 tourouPosition = t.transform.position;
            float   length         = Vector3.Distance(mostFarPosition, tourouPosition);

            if (length <= m_RangeOfAverage)
            {
                mostFarDistances.Add(tourouPosition);
            }
        }

        //遠い灯篭の平均?中間地点の座標
        Vector3 totalPosition = new Vector3();

        foreach (Vector3 p in mostFarDistances)
        {
            totalPosition += p;
        }

        //中間だったらいいなぁ↓
        Vector3 cameraPosition = totalPosition / mostFarDistances.Count;

        return(cameraPosition);
    }
示例#6
0
    // Update is called once per frame
    void Update()
    {
        // フェードアウト/インが終わっていたら
        if (m_HalfPoint2.m_FireworksFadeFlag == true)
        {
            // 花火が上がっているどうか?
            if (m_FireworksIsPlay)
            {
                m_InstantiateFlag = true;

                // 生成を行う
                if (m_InstantiateFlag)
                {
                    InstantiatePrefab();
                    m_FireworksIsPlay = false;
                }
            }

            // HalfPoint2に到達した灯篭と生成された花火の数が一緒なら
            if (m_InstantiateCounter == m_HalfPoint2.m_TourouCount)
            {
                m_FireworksIsPlay = false;
                m_HalfPoint2.m_FireworksFadeFlag = false;
                m_Timer = 0.0f;
            }

            if (m_InstantiateCounter < m_HalfPoint2.m_TourouCount)
            {
                m_Timer += Time.deltaTime;

                if (m_Timer > 3.0f)
                {
                    m_FireworksIsPlay = true;
                    m_Timer           = 0.0f;
                }
            }
        }


        // 花火が全部あがったら
        if (m_FireworksIsPlay == false)
        {
            m_Timer += Time.deltaTime;

            if (m_Timer >= m_NextCoolTime)
            {
                // フェード演出を始めさせる
                m_HalfPoint2.m_FireworksEndingProduction = true;
                m_HalfPoint2.m_FireworksEndingStart      = true;

                // フェード演出が終わっていたら
                if (m_HalfPoint2.m_EndFireworksFadeFlag == true)
                {
                    // 灯篭スクリプトを起動させる
                    foreach (GameObject tourou in GameObject.FindGameObjectsWithTag("Tourou"))
                    {
                        // 灯篭スクリプトを取得
                        Tourou tourouScript = tourou.GetComponent <Tourou>();
                        tourouScript.enabled = true;
                        // Rigidbodyのポジションとローテーションの制約を元に戻す
                        Rigidbody rigidbody = tourou.GetComponent <Rigidbody>();
                        rigidbody.isKinematic = false;
                        rigidbody.constraints = RigidbodyConstraints.FreezePositionY
                                                | RigidbodyConstraints.FreezeRotation;

                        // 灯篭スクリプトが起動後HalfPoint2との当たり判定をしないようにする
                        if (tourouScript.enabled == true)
                        {
                            tourouScript.m_RunOnceFlag = false;
                        }
                    }

                    // Flowスクリプトを追加する(OnTriggerStayがスクリプトを停止させても動いてしまうため、一時的に削除したので付けなおす必要がある)
                    foreach (GameObject river in GameObject.FindGameObjectsWithTag("Flow"))
                    {
                        river.AddComponent <Flow>();
                    }

                    // BuoyancyスクリプトとBuoyancyQuataスクリプトを起動させる
                    foreach (GameObject tourouQuatate in GameObject.FindGameObjectsWithTag("TourouQuatate"))
                    {
                        Buoyancy      buoyancy      = tourouQuatate.GetComponent <Buoyancy>();
                        BuoyancyQuata buoyancyQuata = tourouQuatate.GetComponent <BuoyancyQuata>();
                        buoyancy.enabled      = true;
                        buoyancyQuata.enabled = true;
                    }
                    // フェード演出を終了させる
                    m_HalfPoint2.m_EndFireworksFadeFlag = false;
                    // カメラの追従を戻す
                    GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Chasing_Camera>().enabled = true;
                    // HalfPoint2を止める
                    GameObject.FindGameObjectWithTag("HalfPoint2").GetComponent <HalfPoint2>().enabled = false;
                    // このスクリプトを停止させる
                    this.enabled = false;
                }
            }
        }
    }