/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public void ScheduleCancle() { for (int k = 0; k < changeDay.Count; k++) { csDay tmp = changeDay[k]; int index = tmp.index; int i = index / 42; int j = index % 42; tmp.myWork = (csWork.Work)unDoSchedule[i, j]; tmp.isLastWork = unDoLastWork[i, j]; tmp.icon.spriteName = string.Empty; tmp.icon.alpha = 1.0f; /* * switch (tmp.myWork) * { * case csWork.Work.Nowork: * tmp.sprite.color = Color.white; * break; * case csWork.Work.Kangnam: * tmp.sprite.color = Color.blue; * break; * case csWork.Work.Kangbuk: * tmp.sprite.color = Color.red; * break; * case csWork.Work.Alba: * tmp.sprite.color = Color.yellow; * break; * case csWork.Work.CheonHo: * tmp.sprite.color = Color.yellow; * break; * case csWork.Work.Labor: * tmp.sprite.color = Color.yellow; * break; * case csWork.Work.Plant: * tmp.sprite.color = Color.yellow; * break; * case csWork.Work.Repair: * tmp.sprite.color = Color.yellow; * break; * case csWork.Work.Rest: * tmp.sprite.color = Color.yellow; * break; * default: * break; * } */ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } changeDay.Clear(); }
public void ScheduleDecide() { for (int i = 0; i < 24; i++) { csMonth tmpMonth = MyMonths[i]; for (int j = 0; j < 42; j++) { csDay tmpDay = tmpMonth.MyDays[j]; unDoSchedule[i, j] = (int)tmpDay.myWork; unDoLastWork[i, j] = tmpDay.isLastWork; } } // 업데이트문 UserManager.Instance().WorkUpdate(); SqlQurey(1); }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public void initialization() { for (int i = 0; i < 24; i++) { csMonth tmpMonth = MyMonths[i]; for (int j = 0; j < 42; j++) { csDay tmpDay = tmpMonth.MyDays[j]; tmpDay.myWork = (csWork.Work)unDoSchedule[i, j]; tmpDay.isLastWork = unDoLastWork[i, j]; switch (tmpDay.myWork) { case csWork.Work.Nowork: tmpDay.icon.spriteName = string.Empty; break; case csWork.Work.Kangnam: tmpDay.icon.spriteName = "work_kangnam"; tmpDay.icon.alpha = 0.8f; break; case csWork.Work.Kangbuk: tmpDay.icon.spriteName = "work_kangbuk"; tmpDay.icon.alpha = 0.8f; break; case csWork.Work.Alba: tmpDay.icon.spriteName = "work_alba"; tmpDay.icon.alpha = 0.8f; break; case csWork.Work.CheonHo: tmpDay.icon.spriteName = "work_cheonho"; tmpDay.icon.alpha = 0.8f; break; case csWork.Work.Labor: tmpDay.icon.spriteName = "work_labor"; tmpDay.icon.alpha = 0.8f; break; case csWork.Work.Plant: tmpDay.icon.spriteName = "work_plant"; tmpDay.icon.alpha = 0.8f; break; case csWork.Work.Repair: tmpDay.icon.spriteName = "work_repair"; tmpDay.icon.alpha = 0.8f; break; case csWork.Work.Rest: tmpDay.icon.spriteName = "work_rest"; tmpDay.icon.alpha = 0.8f; break; case csWork.Work.Race: tmpDay.icon.spriteName = "RaceFlag"; tmpDay.icon.alpha = 0.8f; break; default: break; } } } changeDay.Clear(); }
// 질의함수 public void SqlQurey(int type) { string m_ConnectionString; string m_SQLiteFileName = "raceDB.sqlite"; string conn; #if UNITY_EDITOR m_ConnectionString = "URI=file:" + Application.streamingAssetsPath + "/" + m_SQLiteFileName; //m_ConnectionString = "URI=file:" + Application.dataPath + "/" + m_SQLiteFileName; #else // check if file exists in Application.persistentDataPath var filepath = string.Format("{0}/{1}", Application.persistentDataPath, m_SQLiteFileName); if (!File.Exists(filepath)) { // if it doesn't -> // open StreamingAssets directory and load the db -> #if UNITY_ANDROID WWW loadDb = new WWW("jar:file://" + Application.dataPath + "!/assets/" + m_SQLiteFileName); // this is the path to your StreamingAssets in android loadDb.bytesDownloaded.ToString(); while (!loadDb.isDone) { } // CAREFUL here, for safety reasons you shouldn't let this while loop unattended, place a timer and error check // then save to Application.persistentDataPath File.WriteAllBytes(filepath, loadDb.bytes); #elif UNITY_IOS var loadDb = Application.dataPath + "/Raw/" + m_SQLiteFileName; // this is the path to your StreamingAssets in iOS // then save to Application.persistentDataPath File.Copy(loadDb, filepath); #elif UNITY_WP8 var loadDb = Application.dataPath + "/StreamingAssets/" + m_SQLiteFileName; // this is the path to your StreamingAssets in iOS // then save to Application.persistentDataPath File.Copy(loadDb, filepath); #elif UNITY_WINRT var loadDb = Application.dataPath + "/StreamingAssets/" + m_SQLiteFileName; // this is the path to your StreamingAssets in iOS // then save to Application.persistentDataPath File.Copy(loadDb, filepath); #else var loadDb = Application.dataPath + "/StreamingAssets/" + m_SQLiteFileName; // this is the path to your StreamingAssets in iOS // then save to Application.persistentDataPath File.Copy(loadDb, filepath); #endif } m_ConnectionString = "URI=file:" + filepath; #endif ///////////////////////////////////////////////////////////////////[DB Path] if (Application.platform == RuntimePlatform.Android) { conn = "URI=file:" + Application.persistentDataPath + "/raceDB.sqlite"; //Path to databse on Android } else { conn = "URI=file:" + Application.streamingAssetsPath + "/raceDB.sqlite"; } //Path to database Else ///////////////////////////////////////////////////////////////////[DB Path] ///////////////////////////////////////////////////////////////////[DB Connection] IDbConnection dbconn; dbconn = (IDbConnection) new SqliteConnection(conn); dbconn.Open(); //Open connection to the database. ///////////////////////////////////////////////////////////////////[DB Connection] ///////////////////////////////////////////////////////////////////[DB Query] IDbCommand dbcmd = dbconn.CreateCommand(); string sqlQuery; //셀렉트 if (type == 0) { sqlQuery = "SELECT * " + "FROM Schedule"; dbcmd.CommandText = sqlQuery; IDataReader reader = dbcmd.ExecuteReader(); while (reader.Read()) { int index = reader.GetInt32(0); int work = reader.GetInt32(1); int lastWork = reader.GetInt32(2); int i = index / 42; int j = index % 42; unDoSchedule[i, j] = work; unDoLastWork[i, j] = lastWork; } reader.Close(); reader = null; } // 업데이트 else { for (int k = 0; k < changeDay.Count; k++) { csDay tmp = changeDay[k]; int index = tmp.index; int i = index / 42; int j = index % 42; sqlQuery = "UPDATE Schedule SET \"Work\" = " + unDoSchedule[i, j] + ", \"IsLast\" = " + unDoLastWork[i, j] + " WHERE \"Index\" = " + index + ""; dbcmd.CommandText = sqlQuery; dbcmd.ExecuteNonQuery(); } changeDay.Clear(); } dbcmd.Dispose(); dbcmd = null; dbconn.Close(); dbconn = null; }
bool CheckStamina(csWork work) { DateTime nowDate = UserManager.Instance().nowDate; int myStamina = UserManager.Instance().stamina; Debug.Log("처음스태미나 " + myStamina); int myIndex = -1; int workstartIndex = -1; //첫날 인덱스 찾기 for (int i = 0; i < parent_month.MyDays.Count; i++) { csDay tmp = parent_month.MyDays[i]; if (tmp.dt == nowDate) { workstartIndex = i; break; } } // 인덱스 찾기 for (int i = 0; i < parent_month.MyDays.Count; i++) { csDay tmp = parent_month.MyDays[i]; if (tmp.GetInstanceID() == GetInstanceID()) { myIndex = i; break; } } Debug.Log("첫날인덱스 " + workstartIndex); Debug.Log("지금인덱스 " + myIndex); int nextMonthIndex = 0; for (int i = 0; i < 7; i++) { if ((workstartIndex + i) < 42) { csWork.Work tmpWork = csWork.Work.Nowork; if (work.r_Time == 1) { if ((workstartIndex + i) == myIndex) { tmpWork = work.WorkName; } else { tmpWork = parent_month.MyDays[workstartIndex + i].myWork; } } else if (work.r_Time == 2) { if ((workstartIndex + i) == myIndex) { tmpWork = work.WorkName; Debug.Log(work.WorkName); } else if ((workstartIndex + i) == (myIndex + 1)) { tmpWork = work.WorkName; } else { tmpWork = parent_month.MyDays[workstartIndex + i].myWork; } } Debug.Log(work.WorkName); switch (tmpWork) { case csWork.Work.Nowork: break; case csWork.Work.Kangnam: myStamina -= 12; break; case csWork.Work.Kangbuk: myStamina -= 12; break; case csWork.Work.Alba: myStamina -= 11; break; case csWork.Work.CheonHo: myStamina -= 12; break; case csWork.Work.Labor: myStamina -= 12; break; case csWork.Work.Plant: myStamina -= 15; break; case csWork.Work.Repair: myStamina -= 8; break; case csWork.Work.Rest: myStamina += 25; break; } Debug.Log("스태미나" + myStamina); if (myStamina < 0) { return(false); } } else if ((workstartIndex + i) >= 42) { csMonth tmp; if (parent_month.dt.Month == dt.Month) { tmp = manager.MyMonths[dt.Month]; } else { tmp = manager.MyMonths[dt.Month - 1]; } csWork.Work tmpWork = csWork.Work.Nowork; if (work.r_Time == 1) { if ((workstartIndex + i) == myIndex) { tmpWork = work.WorkName; } else { tmpWork = tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].myWork; } } else if (work.r_Time == 2) { if ((workstartIndex + i) == myIndex) { tmpWork = work.WorkName; } else if ((workstartIndex + i) == (myIndex + 1)) { tmpWork = work.WorkName; } else { tmpWork = tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].myWork; } } switch (tmpWork) { case csWork.Work.Nowork: break; case csWork.Work.Kangnam: myStamina -= 12; break; case csWork.Work.Kangbuk: myStamina -= 12; break; case csWork.Work.Alba: myStamina -= 11; break; case csWork.Work.CheonHo: myStamina -= 12; break; case csWork.Work.Labor: myStamina -= 12; break; case csWork.Work.Plant: myStamina -= 15; break; case csWork.Work.Repair: myStamina -= 8; break; case csWork.Work.Rest: myStamina += 25; break; } if (myStamina < 0) { return(false); } nextMonthIndex++; } } return(true); }
void OnDrop(GameObject dropped) { csWork work = dropped.GetComponent <csWork>(); if (work == null) { return; } int myIndex = -1; // 인덱스 찾기 for (int i = 0; i < parent_month.MyDays.Count; i++) { csDay tmp = parent_month.MyDays[i]; if (tmp.GetInstanceID() == GetInstanceID()) { myIndex = i; break; } } // 스케줄 등록 가능한지 확인 DateTime nowDate = UserManager.Instance().nowDate; // 현재날짜보다 뒤에등록하면 취소 if (nowDate > dt) { Debug.Log("뒤다"); DayFail.SetActive(true); return; } int nextMonthIndex = 0; for (int i = 0; i < work.r_Time; i++) { if ((myIndex + i) < 42) { if (parent_month.MyDays[myIndex + i].myWork != csWork.Work.Nowork) { Debug.Log("스케줄못함"); WorkFail.SetActive(true); return; } if (nowDate.AddDays(7) <= parent_month.MyDays[myIndex + i].dt) { Debug.Log("날짜초과"); DayFail.SetActive(true); return; } } else if ((myIndex + i) >= 42) { csMonth tmp; if (parent_month.dt.Month == dt.Month) { tmp = manager.MyMonths[dt.Month]; } else { tmp = manager.MyMonths[dt.Month - 1]; } if (tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].myWork != csWork.Work.Nowork) { Debug.Log("담달스케줄못함"); WorkFail.SetActive(true); return; } if (nowDate.AddDays(7) <= tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].dt) { Debug.Log("날짜초과"); DayFail.SetActive(true); } nextMonthIndex++; } } nextMonthIndex = 0; // 스태미나 부족하면 안되게 해야댐 if (!CheckStamina(work)) { Debug.Log("스태미나부족으로 실패"); StaminaFail.SetActive(true); return; } // 해당 작업으로 아이콘 바꾸기 for (int i = 0; i < work.r_Time; i++) { if ((myIndex + i) < 42) { /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if (work.WorkName == csWork.Work.Kangnam) { parent_month.MyDays[myIndex + i].myWork = csWork.Work.Kangnam; parent_month.MyDays[myIndex + i].icon.spriteName = "work_kangnam"; parent_month.MyDays[myIndex + i].icon.alpha = 0.8f; manager.changeDay.Add(parent_month.MyDays[myIndex + i]); // 마지막 작업일 if (i == (work.r_Time - 1)) { parent_month.MyDays[myIndex + i].isLastWork = 1; } // 다음달 공유부분 if (i + myIndex >= (42 - shardCount)) { Debug.Log("담달"); csMonth tmp; if (parent_month.dt.Year == 2040) { tmp = manager.MyMonths[parent_month.dt.Month]; } else { tmp = manager.MyMonths[parent_month.dt.Month + 12]; } tmp.MyDays[(myIndex + i) - (42 - shardCount)].myWork = csWork.Work.Kangnam; tmp.MyDays[(myIndex + i) - (42 - shardCount)].icon.spriteName = "work_kangnam"; tmp.MyDays[(myIndex + i) - (42 - shardCount)].icon.alpha = 0.8f; if (i == (work.r_Time - 1)) { tmp.MyDays[(myIndex + i) - (42 - shardCount)].isLastWork = 1; } manager.changeDay.Add(tmp.MyDays[(myIndex + i) - (42 - shardCount)]); } // 전달 공유부분 else if (i + myIndex < before_shardCount) { Debug.Log("전달"); csMonth tmp; if (parent_month.dt.Year == 2040) { tmp = manager.MyMonths[parent_month.dt.Month - 2]; } else { tmp = manager.MyMonths[parent_month.dt.Month - 2 + 12]; } tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].myWork = csWork.Work.Kangnam; tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].icon.spriteName = "work_kangnam"; tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].icon.alpha = 0.8f; if (i == (work.r_Time - 1)) { tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].isLastWork = 1; } manager.changeDay.Add(tmp.MyDays[(42 - before_shardCount) + (myIndex + i)]); } } ////////////////////////////////////// else if (work.WorkName == csWork.Work.Kangbuk) { parent_month.MyDays[myIndex + i].myWork = csWork.Work.Kangbuk; parent_month.MyDays[myIndex + i].icon.spriteName = "work_kangbuk"; parent_month.MyDays[myIndex + i].icon.alpha = 0.8f; if (i == (work.r_Time - 1)) { parent_month.MyDays[myIndex + i].isLastWork = 1; } manager.changeDay.Add(parent_month.MyDays[myIndex + i]); if (i + myIndex >= (42 - shardCount)) { Debug.Log("담달"); csMonth tmp; if (parent_month.dt.Year == 2040) { tmp = manager.MyMonths[parent_month.dt.Month]; } else { tmp = manager.MyMonths[parent_month.dt.Month + 12]; } tmp.MyDays[(myIndex + i) - (42 - shardCount)].myWork = csWork.Work.Kangbuk; tmp.MyDays[(myIndex + i) - (42 - shardCount)].icon.spriteName = "work_kangbuk"; tmp.MyDays[(myIndex + i) - (42 - shardCount)].icon.alpha = 0.8f; if (i == (work.r_Time - 1)) { tmp.MyDays[(myIndex + i) - (42 - shardCount)].isLastWork = 1; } manager.changeDay.Add(tmp.MyDays[(myIndex + i) - (42 - shardCount)]); } // 전달 공유부분 else if (i + myIndex < before_shardCount) { Debug.Log("전달"); csMonth tmp; if (parent_month.dt.Year == 2040) { tmp = manager.MyMonths[parent_month.dt.Month - 2]; } else { tmp = manager.MyMonths[parent_month.dt.Month - 2 + 12]; } tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].myWork = csWork.Work.Kangbuk; tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].icon.spriteName = "work_kangbuk"; tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].icon.alpha = 0.8f; if (i == (work.r_Time - 1)) { tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].isLastWork = 1; } manager.changeDay.Add(tmp.MyDays[(42 - before_shardCount) + (myIndex + i)]); } } else if (work.WorkName == csWork.Work.Alba) { parent_month.MyDays[myIndex + i].myWork = csWork.Work.Alba; parent_month.MyDays[myIndex + i].icon.spriteName = "work_alba"; parent_month.MyDays[myIndex + i].icon.alpha = 0.8f; if (i == (work.r_Time - 1)) { parent_month.MyDays[myIndex + i].isLastWork = 1; } manager.changeDay.Add(parent_month.MyDays[myIndex + i]); if (i + myIndex >= (42 - shardCount)) { Debug.Log("담달"); csMonth tmp; if (parent_month.dt.Year == 2040) { tmp = manager.MyMonths[parent_month.dt.Month]; } else { tmp = manager.MyMonths[parent_month.dt.Month + 12]; } tmp.MyDays[(myIndex + i) - (42 - shardCount)].myWork = csWork.Work.Alba; tmp.MyDays[(myIndex + i) - (42 - shardCount)].icon.spriteName = "work_alba"; tmp.MyDays[(myIndex + i) - (42 - shardCount)].icon.alpha = 0.8f; if (i == (work.r_Time - 1)) { tmp.MyDays[(myIndex + i) - (42 - shardCount)].isLastWork = 1; } manager.changeDay.Add(tmp.MyDays[(myIndex + i) - (42 - shardCount)]); } // 전달 공유부분 else if (i + myIndex < before_shardCount) { csMonth tmp; if (parent_month.dt.Year == 2040) { tmp = manager.MyMonths[parent_month.dt.Month - 2]; } else { tmp = manager.MyMonths[parent_month.dt.Month - 2 + 12]; } tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].myWork = csWork.Work.Alba; tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].icon.spriteName = "work_alba"; tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].icon.alpha = 0.8f; if (i == (work.r_Time - 1)) { tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].isLastWork = 1; } manager.changeDay.Add(tmp.MyDays[(42 - before_shardCount) + (myIndex + i)]); } } else if (work.WorkName == csWork.Work.CheonHo) { parent_month.MyDays[myIndex + i].myWork = csWork.Work.CheonHo; parent_month.MyDays[myIndex + i].icon.spriteName = "work_cheonho"; parent_month.MyDays[myIndex + i].icon.alpha = 0.8f; if (i == (work.r_Time - 1)) { parent_month.MyDays[myIndex + i].isLastWork = 1; } manager.changeDay.Add(parent_month.MyDays[myIndex + i]); if (i + myIndex >= (42 - shardCount)) { Debug.Log("담달"); csMonth tmp; if (parent_month.dt.Year == 2040) { tmp = manager.MyMonths[parent_month.dt.Month]; } else { tmp = manager.MyMonths[parent_month.dt.Month + 12]; } tmp.MyDays[(myIndex + i) - (42 - shardCount)].myWork = csWork.Work.CheonHo; tmp.MyDays[(myIndex + i) - (42 - shardCount)].icon.spriteName = "work_cheonho"; tmp.MyDays[(myIndex + i) - (42 - shardCount)].icon.alpha = 0.8f; if (i == (work.r_Time - 1)) { tmp.MyDays[(myIndex + i) - (42 - shardCount)].isLastWork = 1; } manager.changeDay.Add(tmp.MyDays[(myIndex + i) - (42 - shardCount)]); } // 전달 공유부분 else if (i + myIndex < before_shardCount) { csMonth tmp; if (parent_month.dt.Year == 2040) { tmp = manager.MyMonths[parent_month.dt.Month - 2]; } else { tmp = manager.MyMonths[parent_month.dt.Month - 2 + 12]; } tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].myWork = csWork.Work.CheonHo; tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].icon.spriteName = "work_cheonho"; tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].icon.alpha = 0.8f; if (i == (work.r_Time - 1)) { tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].isLastWork = 1; } manager.changeDay.Add(tmp.MyDays[(42 - before_shardCount) + (myIndex + i)]); } } else if (work.WorkName == csWork.Work.Labor) { parent_month.MyDays[myIndex + i].myWork = csWork.Work.Labor; parent_month.MyDays[myIndex + i].icon.spriteName = "work_labor"; parent_month.MyDays[myIndex + i].icon.alpha = 0.8f; if (i == (work.r_Time - 1)) { parent_month.MyDays[myIndex + i].isLastWork = 1; } manager.changeDay.Add(parent_month.MyDays[myIndex + i]); if (i + myIndex >= (42 - shardCount)) { Debug.Log("담달"); csMonth tmp; if (parent_month.dt.Year == 2040) { tmp = manager.MyMonths[parent_month.dt.Month]; } else { tmp = manager.MyMonths[parent_month.dt.Month + 12]; } tmp.MyDays[(myIndex + i) - (42 - shardCount)].myWork = csWork.Work.Labor; tmp.MyDays[(myIndex + i) - (42 - shardCount)].icon.spriteName = "work_labor"; tmp.MyDays[(myIndex + i) - (42 - shardCount)].icon.alpha = 0.8f; if (i == (work.r_Time - 1)) { tmp.MyDays[(myIndex + i) - (42 - shardCount)].isLastWork = 1; } manager.changeDay.Add(tmp.MyDays[(myIndex + i) - (42 - shardCount)]); } // 전달 공유부분 else if (i + myIndex < before_shardCount) { csMonth tmp; if (parent_month.dt.Year == 2040) { tmp = manager.MyMonths[parent_month.dt.Month - 2]; } else { tmp = manager.MyMonths[parent_month.dt.Month - 2 + 12]; } tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].myWork = csWork.Work.Labor; tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].icon.spriteName = "work_labor"; tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].icon.alpha = 0.8f; if (i == (work.r_Time - 1)) { tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].isLastWork = 1; } manager.changeDay.Add(tmp.MyDays[(42 - before_shardCount) + (myIndex + i)]); } } //-------------- else if (work.WorkName == csWork.Work.Plant) { parent_month.MyDays[myIndex + i].myWork = csWork.Work.Plant; parent_month.MyDays[myIndex + i].icon.spriteName = "work_plant"; parent_month.MyDays[myIndex + i].icon.alpha = 0.8f; if (i == (work.r_Time - 1)) { parent_month.MyDays[myIndex + i].isLastWork = 1; } manager.changeDay.Add(parent_month.MyDays[myIndex + i]); if (i + myIndex >= (42 - shardCount)) { Debug.Log("담달"); csMonth tmp; if (parent_month.dt.Year == 2040) { tmp = manager.MyMonths[parent_month.dt.Month]; } else { tmp = manager.MyMonths[parent_month.dt.Month + 12]; } tmp.MyDays[(myIndex + i) - (42 - shardCount)].myWork = csWork.Work.Plant; tmp.MyDays[(myIndex + i) - (42 - shardCount)].icon.spriteName = "work_plant"; tmp.MyDays[(myIndex + i) - (42 - shardCount)].icon.alpha = 0.8f; if (i == (work.r_Time - 1)) { tmp.MyDays[(myIndex + i) - (42 - shardCount)].isLastWork = 1; } manager.changeDay.Add(tmp.MyDays[(myIndex + i) - (42 - shardCount)]); } // 전달 공유부분 else if (i + myIndex < before_shardCount) { csMonth tmp; if (parent_month.dt.Year == 2040) { tmp = manager.MyMonths[parent_month.dt.Month - 2]; } else { tmp = manager.MyMonths[parent_month.dt.Month - 2 + 12]; } tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].myWork = csWork.Work.Plant; tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].icon.spriteName = "work_plant"; tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].icon.alpha = 0.8f; if (i == (work.r_Time - 1)) { tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].isLastWork = 1; } manager.changeDay.Add(tmp.MyDays[(42 - before_shardCount) + (myIndex + i)]); } } //---------------- else if (work.WorkName == csWork.Work.Repair) { parent_month.MyDays[myIndex + i].myWork = csWork.Work.Repair; parent_month.MyDays[myIndex + i].icon.spriteName = "work_repair"; parent_month.MyDays[myIndex + i].icon.alpha = 0.8f; if (i == (work.r_Time - 1)) { parent_month.MyDays[myIndex + i].isLastWork = 1; } manager.changeDay.Add(parent_month.MyDays[myIndex + i]); if (i + myIndex >= (42 - shardCount)) { Debug.Log("담달"); csMonth tmp; if (parent_month.dt.Year == 2040) { tmp = manager.MyMonths[parent_month.dt.Month]; } else { tmp = manager.MyMonths[parent_month.dt.Month + 12]; } tmp.MyDays[(myIndex + i) - (42 - shardCount)].myWork = csWork.Work.Repair; tmp.MyDays[(myIndex + i) - (42 - shardCount)].icon.spriteName = "work_repair"; tmp.MyDays[(myIndex + i) - (42 - shardCount)].icon.alpha = 0.8f; if (i == (work.r_Time - 1)) { tmp.MyDays[(myIndex + i) - (42 - shardCount)].isLastWork = 1; } manager.changeDay.Add(tmp.MyDays[(myIndex + i) - (42 - shardCount)]); } // 전달 공유부분 else if (i + myIndex < before_shardCount) { csMonth tmp; if (parent_month.dt.Year == 2040) { tmp = manager.MyMonths[parent_month.dt.Month - 2]; } else { tmp = manager.MyMonths[parent_month.dt.Month - 2 + 12]; } tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].myWork = csWork.Work.Repair; tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].icon.spriteName = "work_repair"; tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].icon.alpha = 0.8f; if (i == (work.r_Time - 1)) { tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].isLastWork = 1; } manager.changeDay.Add(tmp.MyDays[(42 - before_shardCount) + (myIndex + i)]); } } else if (work.WorkName == csWork.Work.Rest) { parent_month.MyDays[myIndex + i].myWork = csWork.Work.Rest; parent_month.MyDays[myIndex + i].icon.spriteName = "work_rest"; parent_month.MyDays[myIndex + i].icon.alpha = 0.8f; if (i == (work.r_Time - 1)) { parent_month.MyDays[myIndex + i].isLastWork = 1; } manager.changeDay.Add(parent_month.MyDays[myIndex + i]); if (i + myIndex >= (42 - shardCount)) { Debug.Log("담달"); csMonth tmp; if (parent_month.dt.Year == 2040) { tmp = manager.MyMonths[parent_month.dt.Month]; } else { tmp = manager.MyMonths[parent_month.dt.Month + 12]; } tmp.MyDays[(myIndex + i) - (42 - shardCount)].myWork = csWork.Work.Rest; tmp.MyDays[(myIndex + i) - (42 - shardCount)].icon.spriteName = "work_rest"; tmp.MyDays[(myIndex + i) - (42 - shardCount)].icon.alpha = 0.8f; if (i == (work.r_Time - 1)) { tmp.MyDays[(myIndex + i) - (42 - shardCount)].isLastWork = 1; } manager.changeDay.Add(tmp.MyDays[(myIndex + i) - (42 - shardCount)]); } // 전달 공유부분 else if (i + myIndex < before_shardCount) { csMonth tmp; if (parent_month.dt.Year == 2040) { tmp = manager.MyMonths[parent_month.dt.Month - 2]; } else { tmp = manager.MyMonths[parent_month.dt.Month - 2 + 12]; } tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].myWork = csWork.Work.Rest; tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].icon.spriteName = "work_rest"; tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].icon.alpha = 0.8f; if (i == (work.r_Time - 1)) { tmp.MyDays[(42 - before_shardCount) + (myIndex + i)].isLastWork = 1; } manager.changeDay.Add(tmp.MyDays[(42 - before_shardCount) + (myIndex + i)]); } } //-------------- } else if ((myIndex + i) >= 42) { csMonth tmp; if (parent_month.dt.Year == 2040) { if (parent_month.dt.Month == dt.Month) { if (parent_month.dt.Month == 12) { tmp = manager.MyMonths[dt.Month]; } else { tmp = manager.MyMonths[dt.Month]; } } else { if (parent_month.dt.Month == 12) { tmp = manager.MyMonths[dt.Month + 11]; } else { tmp = manager.MyMonths[dt.Month - 1]; } } } else { if (parent_month.dt.Month == dt.Month) { tmp = manager.MyMonths[dt.Month + 12]; } else { tmp = manager.MyMonths[dt.Month - 1 + 12]; } } if (work.WorkName == csWork.Work.Kangnam) { tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].myWork = csWork.Work.Kangnam; tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].icon.spriteName = "work_kangnam"; tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].icon.alpha = 0.8f; if (i == (work.r_Time - 1)) { tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].isLastWork = 1; } manager.changeDay.Add(tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex]); } else if (work.WorkName == csWork.Work.Kangbuk) { tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].myWork = csWork.Work.Kangbuk; tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].icon.spriteName = "work_kangbuk"; tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].icon.alpha = 0.8f; if (i == (work.r_Time - 1)) { tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].isLastWork = 1; } manager.changeDay.Add(tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex]); } else if (work.WorkName == csWork.Work.Alba) { tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].myWork = csWork.Work.Alba; tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].icon.spriteName = "work_alba"; tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].icon.alpha = 0.8f; if (i == (work.r_Time - 1)) { tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].isLastWork = 1; } manager.changeDay.Add(tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex]); } //-------------------- else if (work.WorkName == csWork.Work.CheonHo) { tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].myWork = csWork.Work.CheonHo; tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].icon.spriteName = "work_cheonho"; tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].icon.alpha = 0.8f; if (i == (work.r_Time - 1)) { tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].isLastWork = 1; } manager.changeDay.Add(tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex]); } //------------------- else if (work.WorkName == csWork.Work.Labor) { tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].myWork = csWork.Work.Labor; tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].icon.spriteName = "work_labor"; tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].icon.alpha = 0.8f; if (i == (work.r_Time - 1)) { tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].isLastWork = 1; } manager.changeDay.Add(tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex]); } //------------------ else if (work.WorkName == csWork.Work.Plant) { tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].myWork = csWork.Work.Plant; tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].icon.spriteName = "work_plant"; tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].icon.alpha = 0.8f; if (i == (work.r_Time - 1)) { tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].isLastWork = 1; } manager.changeDay.Add(tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex]); } //------------------ else if (work.WorkName == csWork.Work.Repair) { tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].myWork = csWork.Work.Repair; tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].icon.spriteName = "work_repair"; tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].icon.alpha = 0.8f; if (i == (work.r_Time - 1)) { tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].isLastWork = 1; } manager.changeDay.Add(tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex]); } else if (work.WorkName == csWork.Work.Rest) { tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].myWork = csWork.Work.Rest; tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].icon.spriteName = "work_rest"; tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].icon.alpha = 0.8f; if (i == (work.r_Time - 1)) { tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex].isLastWork = 1; } manager.changeDay.Add(tmp.MyDays[(42 - (parent_month.endIndex + 1)) + tmp.startIndex + nextMonthIndex]); } //--------------- nextMonthIndex++; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } }