Exemplo n.º 1
0
 public void UpdateTargetDialog(CaseSceneDialogPerson caseDialog, SceneDialogPerson data, string modelViewTarget)
 {
     if (data.Data == null)
     {
         return; //fix null:Data
     }
     //Storage.EventsUI.ListLogAdd = "UpdateTargetDialog...........";
     caseDialog.ModelViewTarget = modelViewTarget;
     caseDialog.Activate(data, true);
 }
Exemplo n.º 2
0
        public void Activate(SceneDialogPerson p_Data, bool isTarget = false)
        {
            IsLock = true;
            Person = p_Data;
            if (Dialog != null)
            {
                if (Person.Data != null)
                {
                    if (isTarget)
                    {
                        Dialog.transform.position = p_Data.TargetPosition;
                    }
                    else
                    {
                        Dialog.transform.position = p_Data.Position;
                    }


                    Dialog.SetActive(true);
                    if (isTarget)
                    {
                        Dialog.name = "Dialog_Target_" + ModelViewTarget + "_" + p_Data.NameObject;
                    }
                    else
                    {
                        Dialog.name = "Dialog_" + p_Data.NameObject;
                    }

                    //if (m_dialogView == null)
                    m_dialogView = Dialog.GetComponent <DialogSceneInfo>();

                    ModeInfo = isTarget ? DialogSceneInfo.ModeInfo.Target : DialogSceneInfo.ModeInfo.Person;
                    m_dialogView.DialogModelViewTarget = ModelViewTarget;
                    //IsLock = true;
                    m_dialogView.InitDialogView(this, ModeInfo);
                }
            }
            else
            {
                Debug.Log("######### CaseSceneDialogPerson Dialog is NULL");
            }
            TimeCreate = Time.time;
            //IsLock = true;
        }
Exemplo n.º 3
0
    public CaseSceneDialogPerson CreateTargetDialog(SceneDialogPerson data, string modelViewTarget)
    {
        //CaseSceneDialogPerson caseDialog = GetFreeDialog(new SceneDialogPerson());
        CaseSceneDialogPerson caseDialog = GetFreeDialog(data, isTarget: true);

        if (caseDialog == null)
        {
            caseDialog = GetFreeDialog(isForce: true);
        }
        if (caseDialog == null)
        {
            Storage.EventsUI.ListLogAdd = "#### CASE DEBUG -- EMPTY";
            Debug.Log("######### FillDialogsFromData caseDialog is empty");
            return(null);
        }
        caseDialog.ModelViewTarget = modelViewTarget;
        caseDialog.Activate(data, true);
        return(caseDialog);
    }
Exemplo n.º 4
0
    public void FillDialogsFromData()
    {
        if (!SettingsScene.AutoRefreshOn)
        {
            Storage.EventsUI.ListLogAdd = "IN DEBUG COUNT >>  " + m_collectionPersonData.Count;
        }

        while (m_collectionPersonData.Count > 0)
        {
            SceneDialogPerson data = m_collectionPersonData.Dequeue();
            if (data == null)
            {
                Debug.Log(Storage.EventsUI.ListLogAdd = "#### FillDialogsFromData -- data is EMPTY");
                break;
            }
            if (data.Data == null)
            {
                return; //fix null:Data
            }
            CaseSceneDialogPerson caseDialog = GetFreeDialog(data);
            if (caseDialog == null)
            {
                caseDialog = GetFreeDialog(isForce: true);
            }
            if (caseDialog == null)
            {
                Storage.EventsUI.ListLogAdd = "#### CASE DEBUG -- EMPTY";
                Debug.Log("######### FillDialogsFromData caseDialog is empty");
                break;
            }
            caseDialog.Activate(data);

            if (!SettingsScene.AutoRefreshOn)
            {
                Storage.EventsUI.ListLogAdd = "DEBUG ++ >> " + data.Data.NameObject;
            }
        }
    }
Exemplo n.º 5
0
    private CaseSceneDialogPerson GetFreeDialog(SceneDialogPerson p_Data = null, bool isForce = false, bool thisIsTarget = false, DialogSceneInfo.ModeInfo filerNot = DialogSceneInfo.ModeInfo.Target, bool isTarget = false)
    {
        bool isFindedMe = false;

        if (m_poolDialogPersonPrefabs == null || m_poolDialogPersonPrefabs.Count == 0)
        {
            return(null);
        }

        string _vip = VipID ?? "?";

        CaseSceneDialogPerson findCase = null;

        if (isForce)
        {
            Debug.Log(Storage.EventsUI.ListLogAdd = "#### GetFreeDialog isForce");
            findCase = m_poolDialogPersonPrefabs.OrderBy(p => p.TimeCreate).Where(p => p.Person.ID != _vip).FirstOrDefault();
        }
        else
        {
            if (p_Data != null)
            {
                //Find Exist
                if (!isTarget)
                {
                    findCase = m_poolDialogPersonPrefabs.Find(
                        p => p.Person != null &&
                        p.Person.Data != null &&
                        p.Person.ID == p_Data.ID &&
                        p.ModeInfo != filerNot);
                }
                else
                {
                    //find last view case
                    findCase = m_poolDialogPersonPrefabs.Find(
                        p => p.Person != null &&
                        p.Person.Data != null &&
                        p.Person.ID == p_Data.ID &&
                        p.ModeInfo != DialogSceneInfo.ModeInfo.Person);
                }
            }

            if (findCase != null)
            {
                isFindedMe = true;
            }
            else
            {
                //findCase = m_poolDialogPersonPrefabs.Where(p => !p.IsLock).FirstOrDefault();
                findCase = m_poolDialogPersonPrefabs.Where(p => !p.IsLock &&
                                                           p.ModeInfo != filerNot).FirstOrDefault();
            }

            if (findCase != null && findCase.Person != null && findCase.Person.ID == _vip)
            {
                try
                {
                    //!!!! NullReferenceException: Object reference not set to an instance of an object
                    return(m_poolDialogPersonPrefabs.Where(p => !p.IsLock && p.Person.ID != _vip).FirstOrDefault());
                }
                catch (System.Exception ex)
                {
                    Debug.Log(Storage.EventsUI.ListLogAdd = "### GetFreeDialog : " + ex.Message);
                    ClearTemplate();
                    DialogsClear();
                    RefreshDialogs();
                    return(null);
                }
            }
            if (findCase == null)//force
            {
                //Debug.Log(Storage.EventsUI.ListLogAdd = "#### GetFreeDialog isForce on time");
                //Storage.EventsUI.ListLogAdd = "#### GetFreeDialog isForce on time";
                //findCase = m_poolDialogPersonPrefabs.OrderBy(p => p.TimeCreate).Where(p => p.Person.ID != _vip).FirstOrDefault(); ;
                findCase = m_poolDialogPersonPrefabs.OrderBy(p => p.TimeCreate).Where(p => p.Person.ID != _vip &&
                                                                                      p.ModeInfo != filerNot).FirstOrDefault();
            }
        }

        if (findCase != null && findCase.IsLock && isFindedMe == false)
        {
            findCase.Deactivate();
        }

        return(findCase);
    }