コード例 #1
0
ファイル: EditorWWW.cs プロジェクト: yanagiragi/SWC
    void RunWWW()
    {
        if (Event.current.type == EventType.Repaint)
        {
            if (www.isDone)
            {
                //tex = www.texture;
                if (!string.IsNullOrEmpty(www.error))
                {
                    state = E_EditorWWW.error;
//					Debug.LogError("EditorWWW Error:"+www.error+" at:"+www.url);
                    if (OnFailed != null)
                    {
                        OnFailed(www);
                    }
                }
                else
                {
                    state = E_EditorWWW.done;
                    if (OnSuccess != null)
                    {
                        OnSuccess(www);
                    }
                    if (nextWWW != null)
                    {
                        nextWWW.StartWWW();
                    }
                }
            }
        }
        DoneCheck = false;
    }
コード例 #2
0
ファイル: EditorWWW.cs プロジェクト: yanagiragi/SWC
    public E_EditorWWW Run(bool p_drawButton = false, bool p_drawProgress = false)
    {
        switch (state)
        {
        case E_EditorWWW.none:
            if (p_drawButton)
            {
                if (GUILayout.Button(ButtonStr[0]))                    //"Start Button"
                {
                    StartWWW();
                }
            }
            break;

        case E_EditorWWW.run:
            if (p_drawProgress)
            {
                GUILayout.Label("Up: " + www.uploadProgress * 100 + "% Down: " + www.progress * 100 + "%");
            }
            RunWWW();
            break;

        case E_EditorWWW.done:
            if (p_drawButton)
            {
                if (GUILayout.Button(ButtonStr[1]))                    //"Clear Button"
                {
                    www.Dispose();
                    www   = null;
                    state = E_EditorWWW.none;
                }
            }
            break;

        case E_EditorWWW.error:
            if (p_drawButton)
            {
                GUI.color = Color.red;
                if (GUILayout.Button(ButtonStr[2]))                    //"ReStart Button"
                {
                    StartWWW();
                }
                GUI.color = Color.white;
            }
            break;
        }
        return(state);
    }
コード例 #3
0
ファイル: EditorWWW.cs プロジェクト: yanagiragi/SWC
 void Init(string p_url, DoneGate p_OnSuccess = null, DoneGate p_OnFailed = null, string[] p_ButtonStr = null)
 {
     url       = p_url;
     OnSuccess = p_OnSuccess;
     OnFailed  = p_OnFailed;
     if (p_ButtonStr == null)
     {
         ButtonStr = defaultButtonStr;
     }
     else if (p_ButtonStr.Length != 3)
     {
         ButtonStr = defaultButtonStr;
         Debug.LogError("EditorWWW ButtonStr Length Not 3:" + p_ButtonStr.ToString());
     }
     else
     {
         ButtonStr = p_ButtonStr;
     }
     state = E_EditorWWW.none;
 }
コード例 #4
0
ファイル: EditorWWW.cs プロジェクト: yanagiragi/SWC
 public void StartWWW(DoneGate p_OnSuccess, DoneGate p_OnFailed = null, WWWForm p_form = null)
 {
     form = p_form;
     if (form != null)
     {
         www = new WWW(url, form);
     }
     else
     {
         www = new WWW(url);
     }
     state = E_EditorWWW.run;
     if (p_OnSuccess != null)
     {
         OnSuccess = p_OnSuccess;
     }
     if (p_OnFailed != null)
     {
         OnFailed = p_OnFailed;
     }
     RunWWW();
 }